get-own-enumerable-keys
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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')]

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i get-own-enumerable-keys

    Weekly Downloads

    177,363

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    3.67 kB

    Total Files

    5

    Last publish

    Collaborators

    • sindresorhus