createSortByNumberFn
Creates a sort function for objects by number property.
Available since v1.9.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
property | keyof T | The property to sort by (defaults to 'value'). Always pass an explicit key when T does not have a 'value' property — omitting it on such types produces a no-op comparator (all elements compare equal). null and undefined sort last (treated as +Infinity). Non-numeric values (including booleans — Number(true) === 1, Number(false) === 0) and NaN also sort last. (optional) |
Returns
Section titled “Returns”SortFn<T> — Sort function
Examples
Section titled “Examples”createSortByNumberFn
Section titled “createSortByNumberFn”Related Types
Section titled “Related Types”SortFn
Section titled “SortFn”Sort function type for arrays
