mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Remove baseIteratee and castFunction.
This commit is contained in:
17
findIndex.js
17
findIndex.js
@@ -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. */
|
||||
@@ -14,7 +13,7 @@ const nativeMax = Math.max;
|
||||
* @since 1.1.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=0] The index to search from.
|
||||
* @returns {number} Returns the index of the found element, else `-1`.
|
||||
* @example
|
||||
@@ -27,18 +26,6 @@ const nativeMax = Math.max;
|
||||
*
|
||||
* _.findIndex(users, function(o) { return o.user == 'barney'; });
|
||||
* // => 0
|
||||
*
|
||||
* // The `_.matches` iteratee shorthand.
|
||||
* _.findIndex(users, { 'user': 'fred', 'active': false });
|
||||
* // => 1
|
||||
*
|
||||
* // The `_.matchesProperty` iteratee shorthand.
|
||||
* _.findIndex(users, ['active', false]);
|
||||
* // => 0
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.findIndex(users, 'active');
|
||||
* // => 2
|
||||
*/
|
||||
function findIndex(array, predicate, fromIndex) {
|
||||
const length = array == null ? 0 : array.length;
|
||||
@@ -49,7 +36,7 @@ function findIndex(array, predicate, fromIndex) {
|
||||
if (index < 0) {
|
||||
index = nativeMax(length + index, 0);
|
||||
}
|
||||
return baseFindIndex(array, baseIteratee(predicate, 3), index);
|
||||
return baseFindIndex(array, predicate, index);
|
||||
}
|
||||
|
||||
export default findIndex;
|
||||
|
||||
Reference in New Issue
Block a user