refactor(docs-infra): refactors extractDecoratedClasses (#37135)

This commit removes the dependency on the `lodash` module and refactors
the `extractDecoratedClasses` method.

PR Close #37135
This commit is contained in:
Sonu Kapoor
2020-05-15 11:17:48 -04:00
committed by Kara Erickson
parent 5ca8ba3be9
commit 7543e5925e

View File

@ -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();
doc[doc.docType + 'Options'] = decorator.argumentInfo[0];