@cjser/get-own-enumerable-keys
v1.0.0-cjser.2
Published
Like `Object.keys()` but also includes symbols
Maintainers
Readme
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-keysUsage
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')]cjser
This package is a CommonJS-compatible build generated by cjser for projects that still need require() support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
Original repository: https://github.com/sindresorhus/get-own-enumerable-keys
