• This method is like _.sortBy except that it allows specifying the sort orders of the iteratees to sort by. If orders is unspecified, all values are sorted in ascending order. Otherwise, specify an order of "desc" for descending or "asc" for ascending sort order of corresponding values.

    Type Parameters

    • T

    Parameters

    • collection: undefined | null | List<T>

      The collection to iterate over.

    • Optional iteratees: Many<ListIterator<T, unknown>>

      The iteratees to sort by.

    • Optional orders: Many<boolean | "desc" | "asc">

      The sort orders of iteratees. @param- {Object} [guard] Enables use as an iteratee for functions like _.reduce.

    Returns T[]

    Returns the new sorted array.

    Example

    var users = [
    { 'user': 'fred', 'age': 48 },
    { 'user': 'barney', 'age': 34 },
    { 'user': 'fred', 'age': 42 },
    { 'user': 'barney', 'age': 36 }
    ];

    // sort by `user` in ascending order and by `age` in descending order
    _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
    // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
  • Type Parameters

    • T

    Parameters

    • collection: undefined | null | List<T>
    • Optional iteratees: Many<ListIteratee<T>>
    • Optional orders: Many<boolean | "desc" | "asc">

    Returns T[]

    See

    _.orderBy

  • Type Parameters

    • T extends object

    Parameters

    • collection: undefined | null | T
    • Optional iteratees: Many<ObjectIterator<T, unknown>>
    • Optional orders: Many<boolean | "desc" | "asc">

    Returns T[keyof T][]

    See

    _.orderBy

  • Type Parameters

    • T extends object

    Parameters

    • collection: undefined | null | T
    • Optional iteratees: Many<ObjectIteratee<T>>
    • Optional orders: Many<boolean | "desc" | "asc">

    Returns T[keyof T][]

    See

    _.orderBy

Generated using TypeDoc