Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
730 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var createFind = require('./_createFind'),
|
---|
| 2 | findLastIndex = require('./findLastIndex');
|
---|
| 3 |
|
---|
| 4 | /**
|
---|
| 5 | * This method is like `_.find` except that it iterates over elements of
|
---|
| 6 | * `collection` from right to left.
|
---|
| 7 | *
|
---|
| 8 | * @static
|
---|
| 9 | * @memberOf _
|
---|
| 10 | * @since 2.0.0
|
---|
| 11 | * @category Collection
|
---|
| 12 | * @param {Array|Object} collection The collection to inspect.
|
---|
| 13 | * @param {Function} [predicate=_.identity] The function invoked per iteration.
|
---|
| 14 | * @param {number} [fromIndex=collection.length-1] The index to search from.
|
---|
| 15 | * @returns {*} Returns the matched element, else `undefined`.
|
---|
| 16 | * @example
|
---|
| 17 | *
|
---|
| 18 | * _.findLast([1, 2, 3, 4], function(n) {
|
---|
| 19 | * return n % 2 == 1;
|
---|
| 20 | * });
|
---|
| 21 | * // => 3
|
---|
| 22 | */
|
---|
| 23 | var findLast = createFind(findLastIndex);
|
---|
| 24 |
|
---|
| 25 | module.exports = findLast;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.