[Proposal] ignoreCase method
T.J. Crowder
tj.crowder at farsightsoftware.com
Wed Jun 27 16:01:23 UTC 2018
On Wed, Jun 27, 2018 at 4:37 PM, Robert Wozniak <wozniakj.robert at gmail.com>
wrote:
> ...Second thing, “localeCompare” returns numbers: 0, 1, -1, -2 depends
> on the result, a method proposed by me returns true or false.
This makes your method markedly less useful than `localeCompare`. It's
really useful to know not just that the strings are equal or not equal, but
how they relate to one another lexicographically. For instance, for sorting:
```js
const array = ["c", "a", "B"];
array.sort((a, b) => a.localeCompare(b, undefined, {sensitivity: "base"}));
console.log(array); // "a", "B", "c"
```
-- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180627/8dd37068/attachment.html>
More information about the es-discuss
mailing list