Merge pull request #36 from conblem/pipe

Added Pipe snippet
This commit is contained in:
Angelos Chalaris
2017-12-12 18:15:59 +02:00
committed by GitHub
2 changed files with 18 additions and 0 deletions

8
snippets/pipe.md Normal file
View File

@ -0,0 +1,8 @@
### 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=="
```