0.1.0 • Published 7 years ago
get-all-property-names v0.1.0
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" ]
0.1.0
7 years ago