- sortBy<T extends Record<string | number | symbol, any>>(
propertyName: keyof T,
asc?: boolean,
defaultValue?: unknown,
): (a: T, b: T) => -1 | 0 | 1 Type Parameters
- T extends Record<string | number | symbol, any>
Parameters
- propertyName: keyof T
- asc: boolean = true
- defaultValue: unknown = null
Returns (a: T, b: T) => -1 | 0 | 1
Returns a function that can be used as a callback to
.sort()method. Returned function will sort array by given property.