samuelmarina/is-even

suggestion : use case insensitive comparison

Opened this issue · 1 comments

🙄After watching your video My mind to me : should I delete this suggestion ?

Few suggestions

  • you can use javascript to compare between case insensitive strings rather than writting for every number in different case.
  • Use a json instead of writting such a long if-else statement
  • You can use remainder comparison if it;s 0 or 1
// function for a case insensitive comparision approach
function ciEquals(a, b) {
    return typeof a === 'string' && typeof b === 'string'
        ? a.localeCompare(b, undefined, { sensitivity: 'accent' }) === 0
        : a === b;
}

Case-insensitive comparisons are too expensive for this program, the program must be as efficient as possible to suit enterprise customers.