Skip to content

Instantly share code, notes, and snippets.

@tuan
Created May 28, 2016
Embed
What would you like to do?
let pipe = (value, ...funs) => {
return funs.reduce((accumulator, currentFun) => currentFun(accumulator), value);
}
let add1 = x => x + 1;
let multiply2 = x => x * 2;
pipe(10, add1, add1, multiply2, console.log);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment