Created
June 15, 2020 01:37
-
-
Save 0xemc/4bb4b45ec16e3dac816b9f882b4980a8 to your computer and use it in GitHub Desktop.
Functional Utilities
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
| // AND composition, apply all functions | |
| compose = fns => x => fns.reduceRight((y, f) => f(y), x); | |
| // OR composition, apply functions until one returns true | |
| composeAny = fns => x => fns.some(f => f(x)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment