mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Bump to v4.13.1.
This commit is contained in:
11
findLast.js
11
findLast.js
@@ -1,7 +1,4 @@
|
||||
define(['./findLastIndex', './isArrayLike', './values'], function(findLastIndex, isArrayLike, values) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
define(['./_createFind', './findLastIndex'], function(createFind, findLastIndex) {
|
||||
|
||||
/**
|
||||
* This method is like `_.find` except that it iterates over elements of
|
||||
@@ -23,11 +20,7 @@ define(['./findLastIndex', './isArrayLike', './values'], function(findLastIndex,
|
||||
* });
|
||||
* // => 3
|
||||
*/
|
||||
function findLast(collection, predicate, fromIndex) {
|
||||
collection = isArrayLike(collection) ? collection : values(collection);
|
||||
var index = findLastIndex(collection, predicate, fromIndex);
|
||||
return index > -1 ? collection[index] : undefined;
|
||||
}
|
||||
var findLast = createFind(findLastIndex);
|
||||
|
||||
return findLast;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user