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>

24 lines 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDirectiveDecorator = getDirectiveDecorator; const ts_morph_1 = require("ts-morph"); const string_expression_1 = require("../string-expression"); const typescript_1 = require("../typescript"); /** * Resolves the directive decorator and return its properties. * @param cls - class declaration */ function getDirectiveDecorator(cls) { const decorator = cls.getDecorator('Directive'); const decoratorArgument = decorator?.getArguments()[0]; if (ts_morph_1.Node.isObjectLiteralExpression(decoratorArgument)) { const standaloneProperty = decoratorArgument.getProperty('standalone'); const selectorProperty = decoratorArgument.getProperty('selector'); return { standalone: (0, string_expression_1.stringExpression)((0, typescript_1.getPropertyAssignment)(standaloneProperty)), selector: (0, string_expression_1.stringExpression)((0, typescript_1.getPropertyAssignment)(selectorProperty)), }; } return undefined; } //# sourceMappingURL=get-directive-decorator.js.map