Last active
June 29, 2017 11:04
-
-
Save danrspencer/c77e17ff367ffcc76b8b7e674fa5781f to your computer and use it in GitHub Desktop.
Some functions to allow a more functional paradigm in js
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
export const compose = (...fns) => | |
fns.reduce((f, g) => (...args) => f(g(...args))); | |
export const pipe = (...fns) => compose.apply(compose, fns.reverse()); | |
export const partial = (fn, [args]) => (...moreArgs) => | |
fn(...[args, ...moreArgs]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment