@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
15 lines • 492 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoerceStatements = CoerceStatements;
function CoerceStatements(node, statements, overwrite = false) {
if (overwrite) {
const length = node.getStatements().length;
if (length > 0) {
node.removeStatements([0, length - 1]);
}
}
if (node.getStatements().length === 0) {
node.addStatements(statements);
}
}
//# sourceMappingURL=coerce-statements.js.map