classOwnKeys
Available since v0.9
Returns property keys that are defined target class's prototype. It accepts the following arguments:
target: ConstructorOrAbstractConstructor
- The target classrecursive: boolean = false
- (optional) Iftrue
, then target's prototype chain is traversed and all property keys are returned.
import { classOwnKeys } from '@aedart/support/reflections';
class A {
foo() {}
}
class B extends A {
get bar() {}
}
classOwnKeys(B); // [ 'constructor', 'bar' ]
classOwnKeys(B, true); // [ 'constructor', 'foo', 'bar' ]
Caution
classOwnKeys()
throws TypeError
if target does not have a prototype
property.
Limitation
The classOwnKeys()
function does not return static members of a target class.