@trapi/metadata
Version:
Generate REST-API metadata scheme from TypeScript Decorators.
27 lines • 898 B
JavaScript
;
/*
* Copyright (c) 2023.
* Author Peter Placzek (tada5hi)
* For the full copyright and license information,
* view the LICENSE file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNodeExtensions = void 0;
const decorator_1 = require("../../decorator");
function getNodeExtensions(node, resolver) {
const decorator = resolver.match(decorator_1.DecoratorID.EXTENSION, node);
if (!decorator) {
return [];
}
const output = [];
for (let i = 0; i < decorator.decorators.length; i++) {
const key = decorator.get('key', i);
const value = decorator.get('value', i);
if (typeof key === 'string') {
output.push({ key, value: value });
}
}
return output;
}
exports.getNodeExtensions = getNodeExtensions;
//# sourceMappingURL=module.js.map