MCPcopy Index your code
hub / github.com/microsoft/SandDance / mergeConfig

Function mergeConfig

docs/app/js/sanddance-app.js:106631–106649  ·  view source on GitHub ↗
(...configs)

Source from the content-addressed store, hash-verified

106629}
106630const isLegalKey = (key1)=>key1 !== "__proto__";
106631function mergeConfig(...configs) {
106632 return configs.reduce((out, source)=>{
106633 for(const key2 in source)if (key2 === "signals") // for signals, we merge the signals arrays
106634 // source signals take precedence over
106635 // existing signals with the same name
106636 out.signals = mergeNamed(out.signals, source.signals);
106637 else {
106638 // otherwise, merge objects subject to recursion constraints
106639 // for legend block, recurse for the layout entry only
106640 // for style block, recurse for all properties
106641 // otherwise, no recursion: objects overwrite, no merging
106642 const r = key2 === "legend" ? {
106643 layout: 1
106644 } : key2 === "style" ? true : null;
106645 writeConfig(out, key2, source[key2], r);
106646 }
106647 return out;
106648 }, {});
106649}
106650function writeConfig(output, key3, value, recurse) {
106651 if (!isLegalKey(key3)) return;
106652 let k, o;

Callers

nothing calls this directly

Calls 2

mergeNamedFunction · 0.70
writeConfigFunction · 0.70

Tested by

no test coverage detected