Created
April 3, 2017 02:35
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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