UNPKG

@hyperledger/cactus-common

Version:

Universal library used by both front end and back end components of Cactus. Aims to be a developer swiss army knife.

35 lines (34 loc) 833 B
/** * Utility class responsible for common and tedious tasks involving Javascript objects (instances of classes). */ export declare class Objects { /** * Returns a list of methods for an instance, including the inherited ones. * Example: * * ```javascript * class Base { * constructor() { * } * getX() { * return 'x'; * } * } * * class A extends Base { * getA() { * return 'a'; * } * } * * const a = new A(); * const methodNames = Objects.getAllMethodNames(a); * console.log(methodNames); * // [ 'getA', 'getX' ] * ``` * * @param anObject */ static getAllMethodNames(anObject: unknown): string[]; static getAllFieldNames(anObject: Record<string, unknown>): string[]; }