Function sortBy

  • Creates an array of elements, sorted in ascending order by the results of running each element in a collection through each iteratee. This method performs a stable sort, that is, it preserves the original sort order of equal elements. The iteratees are invoked with one argument: (value).

    Type Parameters

    • T

    Parameters

    • collection: Nullable<ArrayLike<T>>

      The collection to iterate over.

    • Rest...iteratees: Many<ListIteratee<T>>[]

      The iteratees to sort by, specified individually or in arrays.

    Returns T[]

  • Type Parameters

    • T extends object

    Parameters

    • collection: Nullable<T>
    • Rest...iteratees: Many<ObjectIteratee<T>>[]

    Returns T[keyof T][]

    sortBy