mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Bump to v3.6.0.
This commit is contained in:
21
internal/createFindIndex.js
Normal file
21
internal/createFindIndex.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import baseCallback from './baseCallback';
|
||||
import baseFindIndex from './baseFindIndex';
|
||||
|
||||
/**
|
||||
* Creates a `_.findIndex` or `_.findLastIndex` function.
|
||||
*
|
||||
* @private
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {Function} Returns the new find function.
|
||||
*/
|
||||
function createFindIndex(fromRight) {
|
||||
return function(array, predicate, thisArg) {
|
||||
if (!(array && array.length)) {
|
||||
return -1;
|
||||
}
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
return baseFindIndex(array, predicate, fromRight);
|
||||
};
|
||||
}
|
||||
|
||||
export default createFindIndex;
|
||||
Reference in New Issue
Block a user