russplaysguitar / UnderscoreCF

An UnderscoreJS port for Coldfusion. Functional programming library.
http://russplaysguitar.github.com/UnderscoreCF/
MIT License
89 stars 38 forks source link

Add _.REReplace(string, regex, callback, [scope], [context]) #36

Open russplaysguitar opened 11 years ago

russplaysguitar commented 11 years ago

Currently, you cannot pass a callback to REReplace(). I propose adding _.REReplace(string, regex, callback, [scope], [context]) to the library. If a substring is passed instead of a callback, then it would defer to the original REReplace(). Otherwise, it would work similarly to the JS replace() function, which passes the regex match and any group captures to the callback function. To maintain logical similarity to the original REReplace(), the optional scope parameter would work the same as it does in the original.