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:
parent
c2fa65640c
commit
89995075e6
|
@ -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).
|
||||
|
|
Loading…
Reference in New Issue