@rxap/schematics-ts-morph
Version:
This package provides utilities for manipulating TypeScript code using ts-morph, particularly for Angular and NestJS projects. It offers functions to add, coerce, and modify code elements like classes, methods, decorators, and imports. The package also in
16 lines • 487 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoercePropertyKey = CoercePropertyKey;
function CoercePropertyKey(key, drop = false) {
if (key.match(/(^[0-9]+|-|#|\.|@|\/|:|\*)/) &&
!key.match(/\[\w+:\s?\w+\]/)) {
if (drop) {
return key.replace(/(^[0-9]+|-|#|\.|@|\/|:|\*)/g, '');
}
else {
return `'${key}'`;
}
}
return key;
}
//# sourceMappingURL=coerce-property-key.js.map