@taiga-ui/cdk
Version:
Base library for creating Angular components and applications using Taiga UI principles regarding of actual visual appearance
19 lines • 706 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.replaceText = replaceText;
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);
});
}
//# sourceMappingURL=replace-text.js.map