Files
lodash/internal/createSortedIndex.js
John-David Dalton 9724afd7a6 Bump to v3.6.0.
2015-12-16 17:49:07 -08:00

20 lines
658 B
JavaScript

define(['./baseCallback', './binaryIndex', './binaryIndexBy'], function(baseCallback, binaryIndex, 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);
};
}
return createSortedIndex;
});