Creates a function that returns the last element from an iterable or undefined if empty, with optional sorting.
If a comparator is provided, sorts the values before returning the last element.
Otherwise, returns the last element from the values in their original order.
Creates a function that returns the last element from an iterable or undefined if empty, with optional sorting. If a comparator is provided, sorts the values before returning the last element. Otherwise, returns the last element from the values in their original order.