all-keys
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

all-keys

Get all property keys of an object including non-enumerable and inherited ones

Like Reflect.ownKeys() but traverses up the prototype-chain.

Install

$ npm install all-keys

Usage

import allKeys from 'all-keys';

Object.getOwnPropertyNames(Symbol.prototype);
/*
[
	'constructor',
	'toString',
	'valueOf'
]
*/

allKeys(Symbol.prototype);
/*
Set {
	'constructor',
	'toString',
	'valueOf',
	'toLocaleString',
	'hasOwnProperty',
	'isPrototypeOf',
	'propertyIsEnumerable',
	'__defineGetter__',
	'__lookupGetter__',
	'__defineSetter__',
	'__lookupSetter__',
	'__proto__'
}
*/

API

allKeys(object, options?)

Returns a Set of all property names from object.

object

Type: object

options

Type: object

includeObjectPrototype

Type: boolean
Default: true

Include Object.prototype properties like isPrototypeOf.

includeSymbols

Type: boolean
Default: true

Include Symbol keys.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 4.0.0
    4
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 4.0.0
    4
  • 3.1.1
    34
  • 3.1.0
    0
  • 3.0.0
    1
  • 2.0.0
    1

Package Sidebar

Install

npm i all-keys

Weekly Downloads

40

Version

4.0.0

License

MIT

Unpacked Size

4.94 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus