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:
20
internal/createSortedIndex.js
Normal file
20
internal/createSortedIndex.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import baseCallback from './baseCallback';
|
||||
import binaryIndex from './binaryIndex';
|
||||
import binaryIndexBy from './binaryIndexBy';
|
||||
|
||||
/**
|
||||
* Creates a `_.sortedIndex` or `_.sortedLastIndex` function.
|
||||
*
|
||||
* @private
|
||||
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
||||
* @returns {Function} Returns the new index function.
|
||||
*/
|
||||
function createSortedIndex(retHighest) {
|
||||
return function(array, value, iteratee, thisArg) {
|
||||
return iteratee == null
|
||||
? binaryIndex(array, value, retHighest)
|
||||
: binaryIndexBy(array, value, baseCallback(iteratee, thisArg, 1), retHighest);
|
||||
};
|
||||
}
|
||||
|
||||
export default createSortedIndex;
|
||||
Reference in New Issue
Block a user