time-to-botec/js/node_modules/@stdlib/utils/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

propertySymbols

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

Usage

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

propertySymbols( obj )

Returns an array of an object's own symbol.

var symbols = propertySymbols( {} );

Notes

  • In contrast to the built-in Object.getOwnPropertySymbols(), if provided null or undefined, the function returns an empty array, rather than throwing an error.

Examples

var hasSymbolSupport = require( '@stdlib/assert/has-symbol-support' );
var Symbol = require( '@stdlib/symbol/ctor' );
var propertySymbols = require( '@stdlib/utils/property-symbols' );

function Foo() {
    if ( hasSymbolSupport() ) {
        this[ Symbol( 'beep' ) ] = 'boop';
    }
    return this;
}

Foo.prototype.foo = 'bar';

var obj = new Foo();
var symbols = propertySymbols( obj );

console.log( symbols );