We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1daffb4 commit b03718eCopy full SHA for b03718e
governance/xc_admin/packages/xc_admin_common/src/programs/core/core_functions.ts
@@ -68,14 +68,10 @@ function checkSizeOfProductInstruction(
68
/**
69
* Sort object by keys
70
*/
71
-function sortObjectByKeys<T extends Record<string, unknown>>(obj: T): T {
72
- const sortedObj = {} as T;
73
- const keys = Object.keys(obj).sort();
74
- for (const key of keys) {
75
- sortedObj[key as keyof T] = obj[key] as T[keyof T];
76
- }
77
- return sortedObj;
78
-}
+const sortObjectByKeys = <T extends Record<string, unknown>>(obj: T): T =>
+ Object.fromEntries(
+ Object.entries(obj).sort(([a], [b]) => a.localeCompare(b)),
+ ) as T;
79
80
81
* Sort configuration data for consistent output
0 commit comments