MCPcopy Create free account
hub / github.com/Piebald-AI/claude-code-lsps / sortObjectDeep

Function sortObjectDeep

scripts/lsp-definition-utils.mjs:48–62  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

46}
47
48export function sortObjectDeep(value) {
49 if (Array.isArray(value)) {
50 return value.map(sortObjectDeep);
51 }
52
53 if (!isPlainObject(value)) {
54 return value;
55 }
56
57 const sorted = {};
58 for (const key of Object.keys(value).sort()) {
59 sorted[key] = sortObjectDeep(value[key]);
60 }
61 return sorted;
62}
63
64export function reorderKeys(value, preferredOrder) {
65 const result = {};

Callers 1

normalizeServerConfigFunction · 0.85

Calls 1

isPlainObjectFunction · 0.85

Tested by

no test coverage detected