UNPKG

rambda

Version:

Lightweight faster alternative to Ramda

16 lines (14 loc) 306 B
export function replace( pattern, replacer, str ){ if (replacer === undefined){ return (_replacer, _str) => replace( pattern, _replacer, _str ) } else if (str === undefined){ return _str => replace( pattern, replacer, _str ) } return str.replace(pattern, replacer) }