Example 1 — Official Samples
Merge three objects with different keys, then three with a repeated key.
console.log(R.mergeAll([{ foo: 1 }, { bar: 2 }, { baz: 3 }]));
// { foo: 1, bar: 2, baz: 3 }
console.log(R.mergeAll([{ foo: 1 }, { foo: 2 }, { bar: 2 }]));
// { foo: 2, bar: 2 } How It Works
- No clashes. Each object adds a new key, so all three end up in the result.
- A clash.
fooappears twice; the second object comes later, sofoois2. - Fresh object. The result is a new object; the inputs are not modified.
