[Proposal] ignoreCase method

Oriol _ oriol-bugzilla at hotmail.com
Wed Jun 27 17:03:20 UTC 2018

> (`.localeCompare(stringOne, undefined, {sensitivity: "base"})` **is**
fairly verbose, so I'd probably have a utility function for it.)

I would just create a collator outside the loop:

const stringOne = "Matheus";
const manyStrings = ['robert', 'lucas', 'matheus'];
const {compare} = new Intl.Collator(undefined, {sensitivity: "base"});
if (manyStrings.some(s => compare(s, stringOne) == 0)) {
    // Yes, it was found

-- Oriol
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pEpkey.asc
Type: application/pgp-keys
Size: 2497 bytes
Desc: pEpkey.asc
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180627/3e17661e/attachment-0001.bin>

More information about the es-discuss mailing list