(obj: T)
| 42 | * @returns A new object with the same values but keys in alphabetical order |
| 43 | */ |
| 44 | export function sortKeysAlphabetically<T extends object>(obj: T): T { |
| 45 | const sorted = {} as T |
| 46 | for (const key of Object.keys(obj).sort()) { |
| 47 | ;(sorted as Record<string, unknown>)[key] = (obj as Record<string, unknown>)[key] |
| 48 | } |
| 49 | return sorted |
| 50 | } |
no outgoing calls
no test coverage detected