@taiga-ui/cdk
Version:
Base library for creating Angular components and applications using Taiga UI principles regarding of actual visual appearance
20 lines • 736 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.replaceText = void 0;
const ng_morph_1 = require("ng-morph");
const constants_1 = require("../../constants");
function replaceText(replaceable, pattern = constants_1.ALL_FILES) {
const sourceFiles = (0, ng_morph_1.getSourceFiles)(pattern);
sourceFiles.forEach((file) => {
let text = file.getFullText();
replaceable.forEach(({ from, to }) => {
const regexp = new RegExp(from, 'g');
if (text.match(regexp)) {
text = text.replace(regexp, to);
}
});
file.replaceWithText(text);
});
}
exports.replaceText = replaceText;
//# sourceMappingURL=replace-text.js.map