forked from Supositware/Haha-Yes
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
1.7 KiB
JavaScript
20 lines
1.7 KiB
JavaScript
6 years ago
|
'use strict';
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
var replaceStringTransformer = function replaceStringTransformer(replaceWhat, replaceWith) {
|
||
|
return {
|
||
|
onString: function onString(str) {
|
||
|
if (replaceWhat == null || replaceWith == null) {
|
||
|
throw new Error('replaceStringTransformer requires at least 2 arguments.');
|
||
|
}
|
||
|
|
||
|
return str.replace(replaceWhat, replaceWith);
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
|
||
|
exports.default = replaceStringTransformer;
|
||
|
module.exports = exports['default'];
|
||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9yZXBsYWNlU3RyaW5nVHJhbnNmb3JtZXIvcmVwbGFjZVN0cmluZ1RyYW5zZm9ybWVyLmpzIl0sIm5hbWVzIjpbInJlcGxhY2VTdHJpbmdUcmFuc2Zvcm1lciIsInJlcGxhY2VXaGF0IiwicmVwbGFjZVdpdGgiLCJvblN0cmluZyIsInN0ciIsIkVycm9yIiwicmVwbGFjZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxJQUFNQSwyQkFBMkIsU0FBM0JBLHdCQUEyQixDQUFDQyxXQUFELEVBQWNDLFdBQWQ7QUFBQSxTQUErQjtBQUM5REMsWUFEOEQsb0JBQ3JEQyxHQURxRCxFQUNoRDtBQUNaLFVBQUlILGVBQWUsSUFBZixJQUF1QkMsZUFBZSxJQUExQyxFQUFnRDtBQUM5QyxjQUFNLElBQUlHLEtBQUosQ0FDSix5REFESSxDQUFOO0FBR0Q7O0FBRUQsYUFBT0QsSUFBSUUsT0FBSixDQUFZTCxXQUFaLEVBQXlCQyxXQUF6QixDQUFQO0FBQ0Q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