Skip to content

Xotic750/get-own-enumerable-property-symbols-x

Repository files navigation

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

get-own-enumerable-property-symbols-x

Like Object.getOwnPropertySymbols but gets only enumerable properties.

module.exports(target)Array

This method returns only the enumerable own property symbols of an object.

Kind: Exported function
Returns: Array - The enumerable own property symbols.
Throws:

  • typeError - If target is null or undefined.
Param Type Description
target Object The target.

Example

import getOwnEnumerablePropertySymbols from 'get-own-enumerable-property-symbols-x';

var obj = {bar: 1, foo: 2};

const symbol1 = Symbol('first');
Object.defineProperty(obj, symbo1l, {
  enumerable: false,
  value: 'first',
});

const symbol2 = Symbol('second');
Object.defineProperty(obj, symbol2, {
  enumerable: true,
  value: 'second',
});

console.log(getOwnEnumerablePropertySymbols(obj)); // [symbol2]