commonKeysIn

Return the common own and inherited property names of two or more objects.

Usage

var commonKeysIn = require( '@stdlib/utils/common-keys-in' );

commonKeysIn( obj1, obj2[, obj3[,...,objN]] )

Returns the common own and inherited property names of two or more objects.

var obj = {
    'a': 1,
    'b': 2,
    'c': 3
};

var obj2 = {
    'a': 1,
    'b': 2
};

var keys = commonKeysIn( obj, obj2 );
// returns [ 'a', 'b' ]

Examples

var commonKeysIn = require( '@stdlib/utils/common-keys-in' );

function Foo() {
    this.beep = 'boop';
    this.a = {
        'b': 'c'
    };
    return this;
}

Foo.prototype.foo = [ 'bar' ];

var obj1 = new Foo();

var obj2 = {
    'beep': 'boop',
    'foo': 'bar'
};

var keys = commonKeysIn( obj1, obj2 );
// returns [ 'beep', 'foo' ]
Did you find this page helpful?