_replacer.js 234 B

12345678
  1. module.exports = function (regExp, replace) {
  2. var replacer = replace === Object(replace) ? function (part) {
  3. return replace[part];
  4. } : replace;
  5. return function (it) {
  6. return String(it).replace(regExp, replacer);
  7. };
  8. };