pragmatic-fp-ts
Version:
Opinionated functional programming library with easy use in mind
17 lines (16 loc) • 535 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.replace = void 0;
function replace(what, by, where) {
switch (arguments.length) {
case 1:
return function (by_, where_) {
return arguments.length === 1 ? replace(what, by_) : replace(what, by_, where_);
};
case 2:
return (where_) => replace(what, by, where_);
default:
return (where || "").replace(what || "", (by || ""));
}
}
exports.replace = replace;