replaceAll.js 256 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 var makeString = require('./helper/makeString'); module.exports = function replaceAll(str, find, replace, ignorecase) { var flags = (ignorecase === true)?'gi':'g'; var reg = new RegExp(find, flags); return makeString(str).replace(reg, replace); };