Files
30-seconds-of-code/snippets/pipe.md
2017-12-12 17:01:01 +01:00

206 B

Pipe

Use reduce() to pass value through functions.

const pipe = (...funcs) => arg => funcs.reduce((acc, func) => func(acc), arg);
// pipe(btoa, x => x.toUpperCase())("Test") -> "VGVZDA=="