tenfourfox
tenfourfox copied to clipboard
Implement String.prototype.replaceAll
This actually could be useful for some of the other work we're doing. A simple-minded version would take str_replace
in jsstr.cpp
and make one that loops around. It should check that if it got a RegExp
, that the global flag were set. This wouldn't be super fast but it would be a working first pass.
https://bugzilla.mozilla.org/show_bug.cgi?id=1540021 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll
js::str_flat_replace_string
will replace all occurrences. We can just use that.