Created
November 20, 2018 11:54
-
-
Save RoryCombe/4ed3cf1c6070f798853d40099df1973f to your computer and use it in GitHub Desktop.
JavaScript/ES6 Functional utilities
This file contains 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 flip = fn => (a, b) => fn(b, a); | |
const apply = (func, val) => func(val); | |
const flipApply = flip(apply); | |
const pipe = (...args) => x => args.reduce(flipApply, x); | |
const compose = (...args) => pipe(...args.reverse()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment