0.1.0 • Published 7 years ago

get-all-property-names v0.1.0

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

#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" ]