mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import baseCallback from '../internal/baseCallback';
|
||||
import createFindIndex from '../internal/createFindIndex';
|
||||
|
||||
/**
|
||||
* This method is like `_.find` except that it returns the index of the first
|
||||
* element `predicate` returns truthy for, instead of the element itself.
|
||||
* element `predicate` returns truthy for instead of the element itself.
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
@@ -48,17 +48,6 @@ import baseCallback from '../internal/baseCallback';
|
||||
* _.findIndex(users, 'active');
|
||||
* // => 2
|
||||
*/
|
||||
function findIndex(array, predicate, thisArg) {
|
||||
var index = -1,
|
||||
length = array ? array.length : 0;
|
||||
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
while (++index < length) {
|
||||
if (predicate(array[index], index, array)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
var findIndex = createFindIndex();
|
||||
|
||||
export default findIndex;
|
||||
|
||||
Reference in New Issue
Block a user