code: function binaryIndexBy (getValue, item, array) {
      var
        value = item,
        low = 0,
        high = array.length,
        mid, elem;
  
      while (low < high) {
        // divide by two and floor
        mid = low + high >>> 1;
        elem = getValue(array[mid]);
  
        if (elem < value) {
          low = mid + 1;
        } else {
          high = mid;
        }
      }
  
      return high;
    }
docs: Locates an index to insert `item` that would keep `arr` sorted. This uses a binary search and has a worst and average case performance of O(lg n).