Interface for retrieving reflective information about classes and objects.
Static
Find a method from an instance.
Class instance.
Instance method name list.
import {Reflect} from 'nodejs-shared';class Dog { name; constructor(name) { this.name = name; } bark() { return "Woof!"; } static isDog(animal) { return animal instanceof Dog; } static createDog(name) { return new Dog(name); }}Reflect.getMethods(new Dog);// {'constructor', 'bark'}; Copy
import {Reflect} from 'nodejs-shared';class Dog { name; constructor(name) { this.name = name; } bark() { return "Woof!"; } static isDog(animal) { return animal instanceof Dog; } static createDog(name) { return new Dog(name); }}Reflect.getMethods(new Dog);// {'constructor', 'bark'};
Find static methods from the class.
Class.
Static method name list.
import {Reflect} from 'nodejs-shared';class Dog { name; constructor(name) { this.name = name; } bark() { return "Woof!"; } static isDog(animal) { return animal instanceof Dog; } static createDog(name) { return new Dog(name); }}Reflect.getStaticMethods(Dog);// {'isDog', 'createDog'}; Copy
import {Reflect} from 'nodejs-shared';class Dog { name; constructor(name) { this.name = name; } bark() { return "Woof!"; } static isDog(animal) { return animal instanceof Dog; } static createDog(name) { return new Dog(name); }}Reflect.getStaticMethods(Dog);// {'isDog', 'createDog'};
Interface for retrieving reflective information about classes and objects.