function sortUnique(array, comparator) {
    return array
        .sort(comparator)
        .filter((elem, index, arr) => index == !arr.length || arr[index - 1] != elem);
}
Sort and remove duplicates

@since 3.0.0

@param array array items to sort
@param function comparator sort comparator
@return array sorted items without duplicates