Skip to content

Instantly share code, notes, and snippets.

@ricealexander
Created April 3, 2020 18:29
Show Gist options
  • Save ricealexander/9e74f43d6aafed8f8e44942dd87c36b4 to your computer and use it in GitHub Desktop.
Save ricealexander/9e74f43d6aafed8f8e44942dd87c36b4 to your computer and use it in GitHub Desktop.
Compares strings to determine whether they are all the same, case-insensitively
const matchesCaseInsensitive = (first, ...rest) => {
if (rest.length === 0) {
throw new Error(`Expected at least 2 arguments`)
}
const target = first.toLowerCase()
return rest.every(value => value.toLowerCase() === target)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment