Created
November 17, 2017 22:59
-
-
Save iamstarkov/0c25f23af3e6f4b4fa6d0e402656733e to your computer and use it in GitHub Desktop.
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 curry = fn => (...args) => args.length < fn.length | |
? (...rest) => curry(fn)(...args, ...rest) | |
: fn(...args); | |
const applyTo = curry( (x, fn) => fn(x) ); | |
const pipe = (headFN, ...restFns) => (...args) => restFns.reduce(applyTo, headFN(...args)); | |
const prop = curry( (key, x) => x[key] ); | |
const equals = curry( (x, y) => x === y ); | |
const startsWith = curry( (str, x) => x.indexOf(str) === 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment