Home > widget-integration > FilterHelper > sortObjectByKey
FilterHelper.sortObjectByKey() method
Sorts an object by a specified key in its values
Signature:
sortObjectByKey<T>(object: Record<string, T>, key: string, order?: "asc" | "desc"): Record<string, T>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
object |
Record<string, T> |
Object to sort |
|
key |
string |
Key to sort by |
|
order |
"asc" | "desc" |
(Optional) Sort order ('asc' or 'desc') |
Returns:
Record<string, T>
Sorted object