get-own-enumerable-keys-x

2.1.2 • Public • Published

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

get-own-enumerable-keys-x

Like Reflect.ownKeys but gets only enumerable properties.

module.exports(target)Array

This method returns only the enumerable own keys of an object.

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

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

Example

import getOwnEnumerableKeys from 'get-own-enumerable-keys-x';
 
const obj = {bar: 1, foo: 2};
Object.defineProperty(obj, Symbol('first'), {
  enumerable: false,
  value: 'first',
});
 
const symbol = Symbol('second');
Object.defineProperty(obj, symbol, {
  enumerable: true,
  value: 'second',
});
 
console.log(getOwnEnumerableKeys(obj)); // ['bar', 'foo', symbol]

Package Sidebar

Install

npm i get-own-enumerable-keys-x

Weekly Downloads

166

Version

2.1.2

License

MIT

Unpacked Size

444 kB

Total Files

11

Last publish

Collaborators

  • xotic750