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

Function merge_value

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

Source from the content-addressed store, hash-verified

364}
365
366fn merge_value(target: &mut Value, source: &Value) {
367 match (target, source) {
368 (Value::Object(t), Value::Object(s)) => deep_merge(t, s),
369 (Value::Array(t), Value::Array(s)) => {
370 for item in s {
371 if !t.contains(item) {
372 t.push(item.clone());
373 }
374 }
375 }
376 (t, s) => *t = s.clone(),
377 }
378}
379
380#[cfg(test)]
381mod 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