replaceAll.js 256 B

12345678
  1. var makeString = require('./helper/makeString');
  2. module.exports = function replaceAll(str, find, replace, ignorecase) {
  3. var flags = (ignorecase === true)?'gi':'g';
  4. var reg = new RegExp(find, flags);
  5. return makeString(str).replace(reg, replace);
  6. };