sortBy es-toolkit
Returns a new array sorted in ascending order by the given criteria.
Usage
sortBy(arr, criteria)
Use sortBy when you want to sort an array of objects by multiple properties or computed values. Provide property names or transformation functions as an array, and it sorts in ascending order with priority in that order. It's useful for sorting table data or when complex sorting logic is needed.
You can create complex sorting criteria using functions.
Parameters
The array of objects to sort.
Sorting criteria. An array of object property names or transformation functions, with earlier criteria having higher priority.
Returns
Returns a new array sorted in ascending order by the specified criteria.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.