UNPKG

@rxap/ts-morph

Version:

Provides utilities for manipulating TypeScript code using the ts-morph library. It offers a fluent API to add, modify, and remove code elements such as classes, decorators, imports, and properties in both Angular and NestJS projects. This package simplifi

18 lines 739 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CoerceDecorator = CoerceDecorator; const find_function_1 = require("./find-function"); function CoerceDecorator(decoratableNode, name, structure = {}, compareTo = find_function_1.FindByNameFunction) { const match = name.match(/(.+)<(.+)>/); if (match) { name = match[1]; structure.typeArguments = match[2].split(','); } let decorator = decoratableNode.getDecorator(compareTo(Object.assign(Object.assign({}, structure), { name }))); if (!decorator) { decorator = decoratableNode.addDecorator({ name }); decorator.set(structure); } return decorator; } //# sourceMappingURL=coerce-decorator.js.map