UNPKG

@ng-doc/builder

Version:

<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>

32 lines 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getComponentInputs = getComponentInputs; const for_all_classes_1 = require("../typescript/class/for-all-classes"); const is_input_1 = require("./is-input"); /** * Retrieve all existing `@Input` of an Angular component, up through ascendant classes * @param cls - ClassDeclaration * @param condition - (cls: ClassDeclaration) => boolean */ function getComponentInputs(cls) { const properties = new Map(); (0, for_all_classes_1.forAllClasses)(cls, (c) => { c.getProperties().forEach((p) => { if (!properties.has(p.getName()) && (0, is_input_1.isInput)(p)) { properties.set(p.getName(), p); } }); c.getGetAccessors().forEach((p) => { if (!properties.has(p.getName()) && (0, is_input_1.isInput)(p)) { properties.set(p.getName(), p); } }); c.getSetAccessors().forEach((p) => { if (!properties.has(p.getName()) && (0, is_input_1.isInput)(p)) { properties.set(p.getName(), p); } }); }); return Array.from(properties.values()); } //# sourceMappingURL=get-component-inputs.js.map