Function compareByDesc

  • Same as compareBy but orders in descending order

    Type Parameters

    • K extends string | number | symbol
    • V = unknown

    Parameters

    • key: K

      objects will be compared by accessing the property with this key

    • Optionalcomparator: Comparator<V>

      compares the property values

    Returns CompareByKey<K, V>

    a new comparator

  • Same as compareBy but orders in descending order

    Type Parameters

    • T
    • U

    Parameters

    • selector: SelectorFn<T, U>

      a function that transforms a value into another value to be compared

    • Optionalcomparator: Comparator<U>

      compares the transformed values

    Returns Comparator<T>

    a new comparator