It seems lodash's sortedIndex expects a forward sorted array for its binary search to work. (e.g. [0,1,2,4])
Is there a way to used sortedIndexBy when the array is reverse sorted? (e.g. [4,2,1,0])?
> _.sortedIndex( [0,1,2,4], 3 )
> 3
> _.sortedIndex( [4,2,1,0], 3 )
> 4
To get this to work now, I have to reverse the array, find the sortedIndex, insert the new element, and then un-reverse the array.
Note -- need something which works for sorting strings as well as numbers.
['A','B','D'] into ['D','B','A'] and insert 'C'.