MCPcopy
hub / github.com/composerize/composerize / dedupeExactArrayValues

Function dedupeExactArrayValues

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

Source from the content-addressed store, hash-verified

26}
27
28function dedupeExactArrayValues(value) {
29 if (Array.isArray(value)) {
30 const seen = new Set();
31 const result = [];
32
33 value.forEach((entry) => {
34 const normalizedEntry = JSON.stringify(normalizeForCompare(entry));
35 if (seen.has(normalizedEntry)) return;
36
37 seen.add(normalizedEntry);
38 result.push(dedupeExactArrayValues(entry));
39 });
40
41 return result;
42 }
43
44 if (isPlainObject(value)) {
45 return Object.keys(value).reduce((result, key) => {
46 result[key] = dedupeExactArrayValues(value[key]);
47 return result;
48 }, {});
49 }
50
51 return value;
52}
53
54function formatPath(path) {
55 return path.length ? path.join('.') : '<root>';

Callers 1

composerizeCliFunction · 0.85

Calls 2

normalizeForCompareFunction · 0.85
isPlainObjectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…