get-all-property-names

0.1.0 • Public • Published

get-all-property-names stable

npm install get-all-property-names

Get all property names of an object/function/class including non-enumerable and inherited ones.

Is similar to Object.getOwnPropertyNames() but traverses up all the prototype chain of object/function/class.

All properties and methods starting and ending with __, such as __defineGetter__, are removed. All methods and properties from Object will be removed if not are overwritten.

Example

class A {
    metA(){}
}
 
class B extends A {
    metB() {}
}
 
class C extends B {
    metC() {}
}
 
console.log(Object.getOwnPropertyNames(C)); // [ "metC" ]
console.log(getAllPropertyNames(C)); // [ "metA","metB", "metC" ]

Package Sidebar

Install

npm i get-all-property-names

Weekly Downloads

2

Version

0.1.0

License

MIT

Last publish

Collaborators

  • joaquinfq