mathiasbynens / esrever

A Unicode-aware string reverser written in JavaScript.
https://git.io/esrever
MIT License
890 stars 30 forks source link

Help save Esrever (I know we can't use `string.split(str).reverse().join("")` but can't we use `(Array.from(str)).reverse().join("")` or even `[...str].reverse().join("")`) #20

Open Buggem opened 2 years ago

Buggem commented 2 years ago

These days, there are loads of new one-liner JS methods and I think this repo needs a reason to be better than

window.nativeReverse = function(str) {
  return (Array.from(str)).reverse().join("");
}

or

window.nativeReverse = function(str) {
  return [...str].reverse().join("");
}

Yes. These are both one-liners that even follow the exact result of esrevers "foo 𝌆 bar" example. And esrever does "mañana mañana" wrong in Chrome or Firefox and Esrever also has the 'zero-width joiner' issue. Lets hope to see this issue fixed soon, or let esrever fade into the vastness of GitHub.