9 lines
212 B
Markdown
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=="
|
|
```
|