Travis build: 1354
This commit is contained in:
24
README.md
24
README.md
@ -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
@ -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]
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user