MCPcopy Index your code
hub / github.com/simstudioai/sim / sortObjectKeysDeep

Function sortObjectKeysDeep

packages/utils/src/object.ts:58–72  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

56 * matching the stable-serialization callers this serves.
57 */
58export function sortObjectKeysDeep(value: unknown): unknown {
59 if (Array.isArray(value)) {
60 return value.map(sortObjectKeysDeep)
61 }
62 if (value !== null && typeof value === 'object') {
63 const obj = value as Record<string, unknown>
64 return Object.keys(obj)
65 .sort()
66 .reduce((result: Record<string, unknown>, key: string) => {
67 result[key] = sortObjectKeysDeep(obj[key])
68 return result
69 }, {})
70 }
71 return value
72}

Callers 3

sanitizeSubBlocksFunction · 0.90
normalizeResponseFormatFunction · 0.90
object.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected