es-stl - v3.0.2
    Preparing search index...

    Interface SortCallback<T>

    Comparator for sorting and merging values.

    Use the same comparator for every operation that expects an already sorted array. A negative return value means the first value comes before the second value.

    const byAge: SortCallback<{ age: number }> = (a, b) => a.age - b.age;
    

    Type Parameters

    • T

      Compared value type.

    • Compares two values.

      Parameters

      • e1: T

        First value.

      • e2: T

        Second value.

      Returns number

      A negative number when e1 sorts before e2, zero when they are equivalent, or a positive number when e1 sorts after e2.