From 89995075e687dc46e777936d3ebefc2775f58136 Mon Sep 17 00:00:00 2001 From: Sonu Kapoor Date: Fri, 15 May 2020 11:17:48 -0400 Subject: [PATCH] refactor(docs-infra): refactors `extractDecoratedClasses` (#37135) This commit removes the dependency on the `lodash` module and refactors the `extractDecoratedClasses` method. PR Close #37135 --- .../processors/extractDecoratedClasses.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/aio/tools/transforms/angular-api-package/processors/extractDecoratedClasses.js b/aio/tools/transforms/angular-api-package/processors/extractDecoratedClasses.js index e245b40987..1f9bf983bf 100644 --- a/aio/tools/transforms/angular-api-package/processors/extractDecoratedClasses.js +++ b/aio/tools/transforms/angular-api-package/processors/extractDecoratedClasses.js @@ -1,5 +1,3 @@ -var _ = require('lodash'); - module.exports = function extractDecoratedClassesProcessor(EXPORT_DOC_TYPES) { // Add the "directive" docType into those that can be exported from a module @@ -10,12 +8,9 @@ module.exports = function extractDecoratedClassesProcessor(EXPORT_DOC_TYPES) { $runBefore: ['docs-processed'], decoratorTypes: ['Directive', 'Component', 'Pipe', 'NgModule'], $process: function(docs) { - var decoratorTypes = this.decoratorTypes; - - _.forEach(docs, function(doc) { - - _.forEach(doc.decorators, function(decorator) { - + const decoratorTypes = this.decoratorTypes; + docs.forEach(doc => { + (doc.decorators || []).forEach(decorator => { if (decoratorTypes.indexOf(decorator.name) !== -1) { doc.docType = decorator.name.toLowerCase(); // Directives do not always have an argument (i.e. abstract directives).