Travis build: 2000
This commit is contained in:
22
README.md
22
README.md
@ -156,6 +156,7 @@ average(1, 2, 3);
|
||||
* [`reducedFilter`](#reducedfilter)
|
||||
* [`reduceSuccessive`](#reducesuccessive)
|
||||
* [`reduceWhich`](#reducewhich)
|
||||
* [`reject`](#reject)
|
||||
* [`remove`](#remove)
|
||||
* [`sample`](#sample)
|
||||
* [`sampleSize`](#samplesize)
|
||||
@ -2182,6 +2183,27 @@ reduceWhich(
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### reject
|
||||
|
||||
Takes a predicate and array, like `Array.filter()`, but only keeps `x` if `pred(x) === false`.
|
||||
|
||||
```js
|
||||
const reject = (pred, array) => array.filter((...args) => !pred(...args));
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
reject(x => x % 2 === 0, [1, 2, 3, 4, 5]); // [1, 3, 5]
|
||||
reject(word => word.length > 4, ['Apple', 'Pear', 'Kiwi', 'Banana']); // ['Pear', 'Kiwi']
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### remove
|
||||
|
||||
Removes elements from an array for which the given function returns `false`.
|
||||
|
||||
Reference in New Issue
Block a user