Return an array of an object's inherited symbol properties.
var inheritedPropertySymbols = require( '@stdlib/utils/inherited-property-symbols' );
Returns an array
of an object's inherited symbol properties.
var symbols = inheritedPropertySymbols( [ 1, 2, 3 ] );
By default, the function walks an object's entire prototype chain. To limit the inheritance level, provide a level
argument.
var symbols = inheritedPropertySymbols( [ 1, 2, 3 ], 1 );
var hasSymbolSupport = require( '@stdlib/assert/has-symbol-support' );
var Symbol = require( '@stdlib/symbol/ctor' );
var inheritedPropertySymbols = require( '@stdlib/utils/inherited-property-symbols' );
var hasSymbols;
var symbols;
var obj;
hasSymbols = hasSymbolSupport();
function Foo() {
if ( hasSymbols ) {
this[ Symbol( 'a' ) ] = 'b';
}
return this;
}
if ( hasSymbols ) {
Foo.prototype[ Symbol( 'c' ) ] = 'd';
}
obj = new Foo();
symbols = inheritedPropertySymbols( obj );
console.log( symbols );
@stdlib/utils/inherited-keys
: return an array of an object's inherited enumerable property names.@stdlib/utils/inherited-property-descriptors
: return an object's inherited property descriptors.@stdlib/utils/inherited-property-names
: return an array of an object's inherited enumerable and non-enumerable property names.@stdlib/utils/property-symbols
: return an array of an object's own symbol properties.@stdlib/utils/property-symbols-in
: return an array of an object's own and inherited symbol properties.