(array, obj, iteratee, context)
| 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) { |
no test coverage detected