Travis build: 1187
This commit is contained in:
24
README.md
24
README.md
@ -99,6 +99,7 @@ average(1, 2, 3);
|
||||
* [`dropRight`](#dropright)
|
||||
* [`everyNth`](#everynth)
|
||||
* [`filterNonUnique`](#filternonunique)
|
||||
* [`findLast`](#findlast)
|
||||
* [`flatten`](#flatten)
|
||||
* [`forEachRight`](#foreachright)
|
||||
* [`groupBy`](#groupby)
|
||||
@ -799,6 +800,28 @@ filterNonUnique([1, 2, 2, 3, 4, 4, 5]); // [1,3,5]
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### findLast
|
||||
|
||||
Returns the last element for which the provided function returns a truthy value.
|
||||
|
||||
Use `Array.filter()` to remove elements for which `fn` returns falsey values, `Array.slice(-1)` to get the last one.
|
||||
|
||||
```js
|
||||
const findLast = (arr, fn) => arr.filter(fn).slice(-1);
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
findLast([1, 2, 3, 4], n => n % 2 === 1); // 3
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### flatten
|
||||
|
||||
Flattens an array up to the specified depth.
|
||||
@ -5339,6 +5362,7 @@ const httpPost = (url, callback, data = null, err = console.error) => {
|
||||
|
||||
|
||||
|
||||
|
||||
const newPost = {
|
||||
"userId": 1,
|
||||
"id": 1337,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -9,5 +9,5 @@ const findLast = (arr, fn) => arr.filter(fn).slice(-1);
|
||||
```
|
||||
|
||||
```js
|
||||
findLast([1, 2, 3, 4], n => n % 2 === 1) // 3
|
||||
findLast([1, 2, 3, 4], n => n % 2 === 1); // 3
|
||||
```
|
||||
|
||||
@ -32,6 +32,7 @@ const httpPost = (url, callback, data = null, err = console.error) => {
|
||||
|
||||
|
||||
|
||||
|
||||
const newPost = {
|
||||
"userId": 1,
|
||||
"id": 1337,
|
||||
|
||||
Reference in New Issue
Block a user