@metreeca/core - v0.13.0
    Preparing search index...

    Function by

    • Creates a comparator that compares values by a selected key.

      Values are ordered by a key taken from each of them, such as a property, and keys are ordered by comparator.

      Type Parameters

      • V

        The type of values to compare

      • K

        The type of keys to compare

      Parameters

      • selector: (value: V) => K

        Function that extracts the comparison key from a value

      • comparator: Comparator<K> = ascending

        Comparator to apply to the extracted keys (defaults to ascending)

      Returns Comparator<V>

      A comparator ordering values by their selected keys