How to use the sortedIndex function from underscore

Find comprehensive JavaScript underscore.sortedIndex code examples handpicked from public code repositorys.

2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
var i = 0, length = array.length;
if (isSorted) {
  if (typeof isSorted == 'number') {
    i = (isSorted < 0 ? Math.max(0, length + isSorted) : isSorted);
  } else {
    i = _.sortedIndex(array, item);
    return array[i] === item ? i : -1;
  }
}
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
fork icon0
star icon2
watch icon0