Travis build: 1385
This commit is contained in:
24
README.md
24
README.md
@ -77,6 +77,7 @@ average(1, 2, 3);
|
|||||||
<details>
|
<details>
|
||||||
<summary>View contents</summary>
|
<summary>View contents</summary>
|
||||||
|
|
||||||
|
* [`ary`](#ary)
|
||||||
* [`call`](#call)
|
* [`call`](#call)
|
||||||
* [`collectInto`](#collectinto)
|
* [`collectInto`](#collectinto)
|
||||||
* [`flip`](#flip)
|
* [`flip`](#flip)
|
||||||
@ -414,6 +415,29 @@ average(1, 2, 3);
|
|||||||
---
|
---
|
||||||
## 🔌 Adapter
|
## 🔌 Adapter
|
||||||
|
|
||||||
|
### ary
|
||||||
|
|
||||||
|
Creates a function that accepts up to `n` arguments, ignoring any additional arguments.
|
||||||
|
|
||||||
|
Call the provided function, `fn`, with up to `n` arguments, using `Array.slice(0,n)` and the spread operator (`...`).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const ary = (fn, n) => (...args) => fn(...args.slice(0, n));
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Examples</summary>
|
||||||
|
|
||||||
|
```js
|
||||||
|
const firstTwoMax = ary(Math.max, 2);
|
||||||
|
[[2, 6, 'a'], [8, 4, 6], [10]].map(x => firstTwoMax(...x)); // [6, 8, 10]
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<br>[⬆ Back to top](#table-of-contents)
|
||||||
|
|
||||||
|
|
||||||
### call
|
### call
|
||||||
|
|
||||||
Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
|
Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user