rambdax
Version:
Extended version of Rambda - a lightweight, faster alternative to Ramda
22 lines (17 loc) • 360 B
JavaScript
import { curry } from './curry'
import { ok } from './ok'
function replaceAllFn(
patterns, replacer, input
){
ok(
patterns, replacer, input
)(
Array, String, String
)
let text = input
patterns.forEach(singlePattern => {
text = text.replace(singlePattern, replacer)
})
return text
}
export const replaceAll = curry(replaceAllFn)