mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Remove baseIteratee and castFunction.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import baseFindIndex from './_baseFindIndex.js';
|
||||
import baseIteratee from './_baseIteratee.js';
|
||||
import toInteger from './toInteger.js';
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
@@ -15,7 +14,7 @@ const nativeMin = Math.min;
|
||||
* @since 2.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @param {number} [fromIndex=array.length-1] The index to search from.
|
||||
* @returns {number} Returns the index of the found element, else `-1`.
|
||||
* @example
|
||||
@@ -28,18 +27,6 @@ const nativeMin = Math.min;
|
||||
*
|
||||
* _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
|
||||
* // => 2
|
||||
*
|
||||
* // The `_.matches` iteratee shorthand.
|
||||
* _.findLastIndex(users, { 'user': 'barney', 'active': true });
|
||||
* // => 0
|
||||
*
|
||||
* // The `_.matchesProperty` iteratee shorthand.
|
||||
* _.findLastIndex(users, ['active', false]);
|
||||
* // => 2
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.findLastIndex(users, 'active');
|
||||
* // => 0
|
||||
*/
|
||||
function findLastIndex(array, predicate, fromIndex) {
|
||||
const length = array == null ? 0 : array.length;
|
||||
@@ -53,7 +40,7 @@ function findLastIndex(array, predicate, fromIndex) {
|
||||
? nativeMax(length + index, 0)
|
||||
: nativeMin(index, length - 1);
|
||||
}
|
||||
return baseFindIndex(array, baseIteratee(predicate, 3), index, true);
|
||||
return baseFindIndex(array, predicate, index, true);
|
||||
}
|
||||
|
||||
export default findLastIndex;
|
||||
|
||||
Reference in New Issue
Block a user