@extra-object/union

Gives entries present in any object. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:] > Alternatives: [union], [union$]. > Similar: [union], [intersection], [difference], [symmetricDifference], [isDisjoint]. > This is part of package extra-object.

Usage no npm install needed!

<script type="module">
  import extraObjectUnion from 'https://cdn.skypack.dev/@extra-object/union';
</script>

README

Gives entries present in any object. :running: :vhs: :package: :moon: :ledger:

Alternatives: union, union$.
Similar: union, intersection, difference, symmetricDifference, isDisjoint.
This is part of package extra-object.

object.union(x, y, [fc]);
// x:  an object
// y:  another object
// fc: combine function (a, b)
const object = require('extra-object');

var x = {a: 1, b: 2, c: 3};
var y = {b: 20, c: 30, d: 40};
object.union(x, y);
// { a: 1, b: 2, c: 3, d: 40 }

object.union(x, y, (a, b) => b);
// { a: 1, b: 20, c: 30, d: 40 }

references