Skip to content

Commit 0e79211

Browse files
committed
Object assign was not merging these two arrays correctly.
1 parent ae3f260 commit 0e79211

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

merge-protocol-files.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ const protocol1 = JSON.parse(protocol1Text);
1414
const protocol2Text = fs.readFileSync(args[1]);
1515
const protocol2 = JSON.parse(protocol2Text);
1616

17+
var mergedDomains = [];
18+
protocol1.domains.forEach(domain => mergedDomains.push(domain))
19+
protocol2.domains.forEach(domain => mergedDomains.push(domain))
20+
1721
const protocolMerged = {
18-
domains: Object.assign(protocol1.domains, protocol2.domains)
22+
domains: mergedDomains
1923
};
2024

2125
console.log(JSON.stringify(protocolMerged, null, ' '));

0 commit comments

Comments
 (0)