Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

mergeWith

mergeWith(T, V): ?

Keeps the target object intact, then appends to the target object any key-value pairs from the source where the key is not already in the target.

Transform

        
     
1
2
3
4
%dw 2.0
import mergeWith from dw::core::Objects
---
{a: true, b: 1} mergeWith {a: false, c: "Test"}
Output

        
     
1
{"a": false, "b": 1 , "c": "Test"}
mergeWith(Null, T): T

Helper method to make mergeWith null friendly.

mergeWith(T, Null): T

Helper method to make mergeWith null friendly.