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

9 lines
212 B
Markdown

### Pipe
Use `Array.reduce()` to pass value through functions.
```js
const pipe = (...funcs) => arg => funcs.reduce((acc, func) => func(acc), arg);
// pipe(btoa, x => x.toUpperCase())("Test") -> "VGVZDA=="
```