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>

33 lines 981 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.extractSelectors = extractSelectors; exports.getPipeName = getPipeName; const ts_morph_1 = require("ts-morph"); const angular_1 = require("./angular"); /** * * @param declaration */ function extractSelectors(declaration) { if (ts_morph_1.Node.isClassDeclaration(declaration)) { const decorator = (0, angular_1.getComponentDecorator)(declaration) ?? (0, angular_1.getDirectiveDecorator)(declaration); if (decorator) { return decorator.selector?.split(',').map((s) => s.trim()) ?? []; } } return []; } /** * * @param declaration */ function getPipeName(declaration) { if (ts_morph_1.Node.isClassDeclaration(declaration)) { const decorator = (0, angular_1.getPipeDecorator)(declaration); if (decorator) { return decorator.name; } } return undefined; } //# sourceMappingURL=extract-selectors.js.map