declapract
Version:
A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.
11 lines • 466 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.replaceAll = void 0;
const escapeRegExp = (string) => {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
};
const replaceAll = (inString, matchingString, toString) => {
return inString.replace(new RegExp(escapeRegExp(matchingString), 'g'), () => toString);
};
exports.replaceAll = replaceAll;
//# sourceMappingURL=replaceAll.js.map