-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replaceAll #878
Comments
This has reached stage 3. Possibly to replace our custom implementation with future polyfill. One things was added there and that is handling of empty strings: https://github.com/tc39/proposal-string-replaceall#what-happens-if-searchvalue-is-the-empty-string We need to make sure our implementation compensate for that. |
@char0n, so, we need this:
now we have this:
I think we may change this:
to something like this:
and add this to the test cases:
If these ideas look reasonable - I'm ready to prepare and make a PR. |
@js636f your assumptions are correct. But we need a little bit different strategy. If we get this right we might be the first reference implementation. So let's do it in the following way: 1.) Ponyfill Create a ponyfil in our ponyfill directory. This ponyfill must not use anything from ramda or ramda-adjunct bust mu be pure javascript, so that it's framework agnostic. 2.) Implementation Then as usually, we check for String.prototype.replaceAll and use it if present, otherwise use ponyfill. Here is an example how ponyfill can look like: https://twitter.com/_developit/status/1097302964274892800?lang=en (out of date - stage 1) I'm assigning this issue to you, own it, if you wish! |
@js636f would be good for you to watch this issue: tc39/proposal-string-replaceall#29 |
@char0n, OK, thank you! I'm working on this. |
This is my implementation of the base code.
It seems to me it's working and it's in line with the proposal. If it looks OK, then I'm ready to make a PR, to refine it and to change existing replaceAll.js-related things. And I think we need to make a |
Implementation seems about right. Did you base your work on https://github.com/zloirock/core-js/blob/v3.3.2/packages/core-js/modules/esnext.string.replace-all.js ? Regarding ponyfill vs polyfill. When this library was born, we refereed to all the ponyfills incorectly as polyfills. We have a standing issue which should solve this later. So for now (for consistency), put you ponyfill into |
I made the PR. |
Another polyfill https://npmjs.com/string.prototype.replaceall |
https://github.com/tc39/proposal-string-replaceall
Currently in stage 2. Should be fairly safe to implement.
The text was updated successfully, but these errors were encountered: