View Source

objectIntersection

Returns an intersection of the first argument against the second argument's keys.

Installation#

npm i boundless-utils-object-intersection --save

Then use it like:

/** @jsx createElement */

import intersect from 'boundless-utils-object-intersection';

const obj1 = { foo: 'bar', bar: 'baz', baz: 'fizz' };
const obj2 = { bar: 'x' };

intersect(obj1, obj2); // returns `{bar: 'baz'}`