Creates a new Comparator that imposes the ordering defined by the given array. If the produced comparator receives a value, that isn't in the original array, an error will be thrown.
Comparator
const myComparator = comparatorForOrder(['b', 'a', 'c']);['a', 'b', 'c', 'b'].sort(myComparator) == ['b', 'b', 'a', 'c'];
the unique values in desired order
Generated using TypeDoc
Creates a new
Comparator
that imposes the ordering defined by the given array. If the produced comparator receives a value, that isn't in the original array, an error will be thrown.Example