Last active
April 3, 2018 12:14
-
-
Save indongyoo/e0b52b997b79bdfaad9aa85d4db1490b to your computer and use it in GitHub Desktop.
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
| const isAny = a => a !== undefined; | |
| const some = map(isAny, find); | |
| log( some(a => a > 2, [1, 2, 4, 5]) ); | |
| // true | |
| log( some(a => a < 2, [1, 2, 4, 5]) ); | |
| // true | |
| log( some(a => a > 10, [1, 2, 4, 5]) ); | |
| // false | |
| const isUndefined = a => a === undefined; | |
| const none = map(isUndefined, find); | |
| log( none(a => a > 2, [1, 2, 4, 5]) ); | |
| // false | |
| log( none(a => a < 2, [1, 2, 4, 5]) ); | |
| // false | |
| log( none(a => a > 10, [1, 2, 4, 5]) ); | |
| // true | |
| const not = a => !a; | |
| const every = (f, coll) => isUndefined(find(map(not, f), coll)); | |
| log( every(a => a < 2, [1, 2, 4, 5]) ); | |
| // false | |
| log( every(a => a > 10, [1, 2, 4, 5]) ); | |
| // false | |
| log( every(a => a > 0, [1, 2, 4, 5]) ); | |
| // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment