Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

incorrect ponyfill for replaceAll()

See original GitHub issue

Hi! I was experimenting with replaceAll() from ramda adjunct version 2.27.0 and found the internal ponyfill has some inconsistencies with the native browser version.

Here is the code I tried in both browser and runkit:

// browser version:
''.replaceAll('.', '$$$$$') // prints 'foo$$$bar' in Chrome 85, Windows 7

// runkit version:
RA.replaceAll('.', '$$$$$', '') // prints 'foo$$$$$bar'

( runkit code can be seen here: )

It turns out, that the new implementation of String.prototype.replace() has a few special character patterns, that are handled differently as one would expect – for example $$ is turned into $ – and String.prototype.replaceAll() inherits this behavior.

Please update to include these special patterns, or have a standalone implementation of replaceAll without using String.prototype.replaceAll(), even if it’s accessible.

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

js636fcommented, Sep 15, 2020

@char0n this sounds reasonable, I think we should go this way

meszaros-lajos-gyorgycommented, Dec 15, 2020

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

String.prototype.replaceAll() - JavaScript - MDN Web Docs
The replaceAll() method returns a new string with all matches of a pattern replaced by a replacement . The pattern can be a...
Read more >
string-replace-all-ponyfill - npm
Start using string-replace-all-ponyfill in your project by running `npm i string-replace-all-ponyfill`. There are no other projects in the ...
Read more >
Polyfills or Ponyfills? - Ponyfoo
Sometimes we can't implement a solution that's fully spec-compliant, and in those cases using a polyfill might be the wrong answer. A polyfill ......
Read more >
css-vars-ponyfill - GitHub Pages
setProperty() interface. Note that the when options.onlyLegacy is false , modern browsers with native support for CSS custom properties are treated as legacy ......
Read more >
How do I replace all occurrences of a string in JavaScript ...
includes() method determines whether one string may be found within another string, returning true or false as appropriate. String.substring() ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found