MCPcopy
hub / github.com/composerize/composerize / normalizeForCompare

Function normalizeForCompare

packages/composerize/cli-merge.js:14–22  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

12}
13
14function normalizeForCompare(value) {
15 if (Array.isArray(value)) return value.map(normalizeForCompare);
16 if (!isPlainObject(value)) return value;
17
18 return Object.keys(value).sort().reduce((result, key) => {
19 result[key] = normalizeForCompare(value[key]);
20 return result;
21 }, {});
22}
23
24function valuesAreEqual(left, right) {
25 return JSON.stringify(normalizeForCompare(left)) === JSON.stringify(normalizeForCompare(right));

Callers 2

valuesAreEqualFunction · 0.85
dedupeExactArrayValuesFunction · 0.85

Calls 1

isPlainObjectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…