string-replace
Asynchronous version of String.prototype.replace.
Example
; { // Do some async stuff here. // Arguments to this function are almost the same as for String.prototype.replace. // Except for the callback. // ... ;}
API
stringReplace(string, pattern, replacer(cb, match, ...), [opts], cb(err, result))
Applies String.prototype.replace asynchronously.
Replaces all occurences of pattern
(regexp or string) in a string
with invocations of replacer
function. Functionally equivalent to string.replace(pattern, replacer(match, ...))
but replacer
has to return value by calling cb
.
Replacers are firing in sequence unless opts.parallel
is set to true
.
Install
npm install string-replace
License
MIT