Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
var baseEachRight = require('../internal/baseEachRight'),
2
createFind = require('../internal/createFind');
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
* @category Collection
11
* @param {Array|Object|string} collection The collection to search.
12
* @param {Function|Object|string} [predicate=_.identity] The function invoked
13
* per iteration.
14
* @param {*} [thisArg] The `this` binding of `predicate`.
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(baseEachRight, true);
24
25
module.exports = findLast;
26
27