2016-10-10 03:43:44 +02:00
|
|
|
var createFind = require('./_createFind'),
|
|
|
|
findLastIndex = require('./findLastIndex');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is like `_.find` except that it iterates over elements of
|
|
|
|
* `collection` from right to left.
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
* @memberOf _
|
|
|
|
* @since 2.0.0
|
|
|
|
* @category Collection
|
|
|
|
* @param {Array|Object} collection The collection to inspect.
|
2016-11-03 01:33:53 +01:00
|
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
2016-10-10 03:43:44 +02:00
|
|
|
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
|
|
|
* @returns {*} Returns the matched element, else `undefined`.
|
|
|
|
* @example
|
|
|
|
*
|
|
|
|
* _.findLast([1, 2, 3, 4], function(n) {
|
|
|
|
* return n % 2 == 1;
|
|
|
|
* });
|
|
|
|
* // => 3
|
|
|
|
*/
|
|
|
|
var findLast = createFind(findLastIndex);
|
|
|
|
|
|
|
|
module.exports = findLast;
|