MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / merge_value

Function merge_value

atomic-agent/src/hooks/manifest.rs:328–340  ·  view source on GitHub ↗
(target: &mut Value, source: &Value)

Source from the content-addressed store, hash-verified

326}
327
328fn merge_value(target: &mut Value, source: &Value) {
329 match (target, source) {
330 (Value::Object(t), Value::Object(s)) => deep_merge(t, s),
331 (Value::Array(t), Value::Array(s)) => {
332 for item in s {
333 if !t.contains(item) {
334 t.push(item.clone());
335 }
336 }
337 }
338 (t, s) => *t = s.clone(),
339 }
340}
341
342#[cfg(test)]
343mod tests {

Callers 1

deep_mergeFunction · 0.85

Calls 4

deep_mergeFunction · 0.85
containsMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected