strReplace.js 222 B

12345678
  1. /**
  2. * Alternative to the standard String.prototype.replace function
  3. * Avoids problems with $$, $1, $2, ...
  4. */
  5. module.exports = function(str, searched, replacement) {
  6. return str.split(searched).join(replacement);
  7. };