Add _.comparator and align sortedIndex to sortBy

Resolves #1768 and fixes #1834

This could use some review and thoughts