MCPcopy Create free account
hub / github.com/codeaashu/claude-code / sortKeysDeep

Function sortKeysDeep

src/services/remoteManagedSettings/index.ts:112–124  ·  view source on GitHub ↗

* Recursively sort all keys in an object to match Python's json.dumps(sort_keys=True)

(obj: unknown)

Source from the content-addressed store, hash-verified

110 * Recursively sort all keys in an object to match Python's json.dumps(sort_keys=True)
111 */
112function sortKeysDeep(obj: unknown): unknown {
113 if (Array.isArray(obj)) {
114 return obj.map(sortKeysDeep)
115 }
116 if (obj !== null && typeof obj === 'object') {
117 const sorted: Record<string, unknown> = {}
118 for (const key of Object.keys(obj).sort()) {
119 sorted[key] = sortKeysDeep((obj as Record<string, unknown>)[key])
120 }
121 return sorted
122 }
123 return obj
124}
125
126/**
127 * Compute checksum from settings content for HTTP caching

Callers 1

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected