The type of the objects in the array.
The array of objects to sort.
The property to sort the objects by. Can be a dot-separated string to group by a nested property, e.g. "prop1.prop2".
The order to sort the objects in. Defaults to 'asc'. 'desc' for descending order.
A Result
object containing the sorted array on success, or an Error
object on
failure.
Generated using TypeDoc v0.24.7
Sorts an array of objects by a given property in ascending or descending order.
Remarks
This function does not mutate the input array.
Throws
If the input array is null, undefined, or empty.
Throws
If the specified property to sort by does not exist in one or more of the objects in the array.
Example
Sort by age in ascending order:
Example
Sort by name in descending order:
Example
Sort by a nested property: