MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / sortedIndex

Function sortedIndex

docs/_static/underscore-1.13.1.js:1262–1271  ·  view source on GitHub ↗
(array, obj, iteratee, context)

Source from the content-addressed store, hash-verified

1260 // Use a comparator function to figure out the smallest index at which
1261 // an object should be inserted so as to maintain order. Uses binary search.
1262 function sortedIndex(array, obj, iteratee, context) {
1263 iteratee = cb(iteratee, context, 1);
1264 var value = iteratee(obj);
1265 var low = 0, high = getLength(array);
1266 while (low < high) {
1267 var mid = Math.floor((low + high) / 2);
1268 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
1269 }
1270 return low;
1271 }
1272
1273 // Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
1274 function createIndexFinder(dir, predicateFind, sortedIndex) {

Callers 1

createIndexFinderFunction · 0.85

Calls 2

cbFunction · 0.85
iterateeFunction · 0.85

Tested by

no test coverage detected