Travis build: 1584

This commit is contained in:
30secondsofcode
2018-02-07 10:24:32 +00:00
parent da80f53f2b
commit 2b2e88738c
3 changed files with 37 additions and 4 deletions

View File

@ -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
```