(array, obj, iteratee, context)
| 1288 | // Use a comparator function to figure out the smallest index at which |
| 1289 | // an object should be inserted so as to maintain order. Uses binary search. |
| 1290 | function sortedIndex(array, obj, iteratee, context) { |
| 1291 | iteratee = cb(iteratee, context, 1); |
| 1292 | var value = iteratee(obj); |
| 1293 | var low = 0, high = getLength(array); |
| 1294 | while (low < high) { |
| 1295 | var mid = Math.floor((low + high) / 2); |
| 1296 | if (iteratee(array[mid]) < value) low = mid + 1; else high = mid; |
| 1297 | } |
| 1298 | return low; |
| 1299 | } |
| 1300 | |
| 1301 | // Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions. |
| 1302 | function createIndexFinder(dir, predicateFind, sortedIndex) { |
no test coverage detected
searching dependent graphs…