Skip to content

Instantly share code, notes, and snippets.

@mendes5
Created April 3, 2017 02:35
Show Gist options
  • Select an option

  • Save mendes5/280b9712f5e7116e418f83180c99e7d7 to your computer and use it in GitHub Desktop.

Select an option

Save mendes5/280b9712f5e7116e418f83180c99e7d7 to your computer and use it in GitHub Desktop.
Chek if an item is equal to any in an array, coz a == '.png' || a == '.jpg' || a == '.gif' sucks
//Only work with primitives values
const isEqualToAny = (input, items = []) => {
let result = false
items.map(i => !result && (result = i === input))
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment