• Sorts the array

    Example

    orderBy([2, 1, 2, 5]); // [1,2,2,5]
    

    Example

    orderBy([2, 1, 2, 5], "desc"); // [5,2,2,1]
    

    Type Parameters

    • Value

    Parameters

    • arr: Value[]
    • Optional order: OrderT

    Returns Value[]

  • Sorts the array

    Example

    orderBy([{count:1}, {count:20}, {count:15}], "count", "asc"); // [{count:1},{count:15},{count:20}]
    

    Type Parameters

    • Value extends Record<string, unknown>

    • Path extends string = never

    Parameters

    • array: Value[]
    • field: Path
    • Optional order: OrderT

    Returns Value[]

Generated using TypeDoc