Travis build: 1354

This commit is contained in:
30secondsofcode
2018-01-23 19:03:54 +00:00
parent 0e2475f480
commit 3107a255fd
3 changed files with 29 additions and 2 deletions

View File

@ -80,6 +80,7 @@ average(1, 2, 3);
* [`call`](#call) * [`call`](#call)
* [`collectInto`](#collectinto) * [`collectInto`](#collectinto)
* [`flip`](#flip) * [`flip`](#flip)
* [`over`](#over)
* [`pipeFunctions`](#pipefunctions) * [`pipeFunctions`](#pipefunctions)
* [`promisify`](#promisify) * [`promisify`](#promisify)
* [`spreadOver`](#spreadover) * [`spreadOver`](#spreadover)
@ -472,6 +473,29 @@ Object.assign(b, a); // == b
<br>[⬆ Back to top](#table-of-contents) <br>[⬆ Back to top](#table-of-contents)
### over
Creates a function that invokes each provided function with the arguments it receives and returns the results.
Use `Array.map()` and `Function.apply()` to apply each function to the given arguments.
```js
const over = (...fns) => (...args) => fns.map(fn => fn.apply(null, args));
```
<details>
<summary>Examples</summary>
```js
const minMax = over(Math.min, Math.max);
minMax(1, 2, 3, 4, 5); // [1,5]
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### pipeFunctions ### pipeFunctions
Performs left-to-right function composition. Performs left-to-right function composition.

File diff suppressed because one or more lines are too long

View File

@ -10,5 +10,5 @@ const over = (...fns) => (...args) => fns.map(fn => fn.apply(null, args));
```js ```js
const minMax = over(Math.min, Math.max); const minMax = over(Math.min, Math.max);
minMax(1,2,3,4,5); // [1,5] minMax(1, 2, 3, 4, 5); // [1,5]
``` ```