UNPKG

@malagu/core

Version:
21 lines (18 loc) 594 B
export function getSuperClasses(constructor: any): any[] { const constructors = []; let current = constructor; while (Object.getPrototypeOf(current)) { current = Object.getPrototypeOf(current); constructors.push(current); } return constructors; } export function getPropertyNames(obj: any) { const propertyNames: string[] = []; do { propertyNames.push(...Object.getOwnPropertyNames(obj)); obj = Object.getPrototypeOf(obj); } while (obj); // get unique property names return Array.from(new Set<string>(propertyNames)); }