get-own-enumerable-keys
Like `Object.keys()` but also includes symbols
Last updated 2 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install get-own-enumerable-keys 
SYNC missed versions from official npm registry.

get-own-enumerable-keys

Like Object.keys() but also includes symbols

Object.keys() returns the own enumerable keys of an object except symbols (for legacy reasons). This package includes symbols too.

Use Reflect.ownKeys() if you also want non-enumerable keys.

Install

npm install get-own-enumerable-keys

Usage

import getOwnEnumerableKeys from 'get-own-enumerable-keys';

const symbol = Symbol('x');

const object = {
	foo: true,
	[symbol]: true,
};

Object.keys(object);
// ['foo']

getOwnEnumerableKeys(object);
//=> ['foo', Symbol('x')]

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

2 Versions

  • 1.0.0                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |