2.0.0 • Published 5 years ago

all-property-names v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

all-property-names Build Status

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

Like Object.getOwnPropertyNames() but traverses up the prototype-chain.

Install

$ npm install --save all-property-names

Usage

const allPropertyNames = require('all-property-names');

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

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

API

allPropertyNames(input)

Returns a Set.

input

Type: Object

License

MIT © Sindre Sorhus