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