Travis build: 1584
This commit is contained in:
@ -6,14 +6,13 @@ Use `Array.map()` and `Function.apply()` to apply each function to the given arg
|
||||
Use the spread operator (`...`) to call `coverger` with the results of all other functions.
|
||||
|
||||
```js
|
||||
const converge = (converger, fns) => (...args) =>
|
||||
converger(...fns.map(fn => fn.apply(null, args)));
|
||||
const converge = (converger, fns) => (...args) => converger(...fns.map(fn => fn.apply(null, args)));
|
||||
```
|
||||
|
||||
```js
|
||||
const average = converge((a, b) => a / b, [
|
||||
arr => arr.reduce((a, v) => a + v, 0),
|
||||
arr => arr.length,
|
||||
arr => arr.length
|
||||
]);
|
||||
average([1, 2, 3, 4, 5, 6, 7]); // 4
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user