comparator(T) = fun((T, T) -> boolean())
order() = ascending | descending
by/1 | Equivalent to by(F, ascending). |
by/2 | Creates a comparison function (comparator(A) ) compatible with
lists:sort/2 , using the extracted term to sort in the given
direction. |
by_prop/1 | Equivalent to by_prop(Key, ascending). |
by_prop/2 | Creates a comparator for maps, sorting by a given property, in the given direction. |
by_prop/3 | Creates a comparator for maps, sorting by the given property and
using the Default as fallback value, to sort in the provided
direction. |
concat/1 | Composes multiple comparators together. |
reverse/1 | Reverses the order in which elements are sorted by a comparator. |
by(F::fun((A) -> B)) -> comparator(A)
Equivalent to by(F, ascending).
by(Extractor::fun((A) -> B), X2::order()) -> comparator(A)
Creates a comparison function (comparator(A)
) compatible with
lists:sort/2
, using the extracted term to sort in the given
direction.
by_prop(Key::term()) -> comparator(map())
Equivalent to by_prop(Key, ascending).
by_prop(Key::term(), Order::order()) -> comparator(map())
Creates a comparator for maps, sorting by a given property, in the given direction.
by_prop(Key, Default, Order::order()) -> comparator(map())
Creates a comparator for maps, sorting by the given property and
using the Default
as fallback value, to sort in the provided
direction.
concat(Comparators::[Comp, ...]) -> Comp
Composes multiple comparators together.
Fallthrough happens when 2 items are considered equivalent _according to the comparators_. Specifically, this means whenCompare(A, B) ==
Compare(B, A)
.
reverse(Comparator::comparator(T)) -> comparator(T)
Reverses the order in which elements are sorted by a comparator.
Generated by EDoc