MCPcopy Create free account
hub / github.com/dwgx/WindsurfAPI / deepMerge

Function deepMerge

src/runtime-config.js:89–104  ·  view source on GitHub ↗
(base, override)

Source from the content-addressed store, hash-verified

87const SYSTEM_PROMPT_KEYS = new Set(Object.keys(DEFAULTS.systemPrompts));
88
89function deepMerge(base, override) {
90 if (!override || typeof override !== 'object') return base;
91 const out = { ...base };
92 for (const [k, v] of Object.entries(override)) {
93 // Skip prototype-polluting keys — the JSON loaded here is user-writable
94 // via the dashboard, and a crafted key would otherwise corrupt every
95 // object in the process.
96 if (k === '__proto__' || k === 'constructor' || k === 'prototype') continue;
97 if (v && typeof v === 'object' && !Array.isArray(v)) {
98 out[k] = deepMerge(base[k] || {}, v);
99 } else {
100 out[k] = v;
101 }
102 }
103 return out;
104}
105
106let _state = structuredClone(DEFAULTS);
107

Callers 2

loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected