time-to-botec/js/node_modules/@stdlib/utils/inherited-property-symbols
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00
..
docs feat: add the node modules 2022-12-03 12:44:49 +00:00
lib feat: add the node modules 2022-12-03 12:44:49 +00:00
package.json feat: add the node modules 2022-12-03 12:44:49 +00:00
README.md feat: add the node modules 2022-12-03 12:44:49 +00:00

inheritedPropertySymbols

Return an array of an object's inherited symbol properties.

Usage

var inheritedPropertySymbols = require( '@stdlib/utils/inherited-property-symbols' );

inheritedPropertySymbols( obj[, level] )

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 );

Examples

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 );