npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

all-keys

3.1.0 • Public • Published

all-keys Build Status

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

const allKeys = require('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.

License

MIT © Sindre Sorhus

install

npm i all-keys

Downloadsweekly downloads

9

version

3.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability