iter-fns - v0.13.0
    Preparing search index...

    Function comparing

    • Creates a comparator from a projection.

      Note that f will be called twice on every comparison, so when sorting an array of size n f will be called 2n log2 n times.

      If you are performing a sort the computation for the key is expensive, consider using sortOn or sortedOn which will compute all the keys up front before sorting.

      Type Parameters

      • T

        type of the item

      • K

        type of the key

      Parameters

      • f: (x: T) => K

        the projection

      • cmp: Compare<K> = compare

        the comparator

      Returns Compare<T>