Created
December 22, 2017 21:21
-
-
Save lsmoura/0446cb48aad0c768e022ac4018f07c8e 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
// Returns true if *all* parameters are true | |
const all = (...args) => ( | |
args.reduce( | |
(answer, current) => answer && current, | |
true | |
) | |
); | |
// Returns true if *any* of the parameters is true | |
const any = (...args) => ( | |
args.reduce( | |
(answer, current) => answer || current, | |
false | |
) | |
); | |
// Returns false if *none* of the parameters is true | |
const none = (...args) => ( | |
args.reduce( | |
(answer, current) => answer && !current, | |
true | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment