MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / parentClassOf

Function parentClassOf

Extension/src/Utility/System/info.ts:47–53  ·  view source on GitHub ↗
(instance: AribtraryObject | Constructor)

Source from the content-addressed store, hash-verified

45}
46
47export function parentClassOf(instance: AribtraryObject | Constructor): Constructor | undefined {
48 if (is.nullish(instance)) {
49 return undefined;
50 }
51 const parent = Object.getPrototypeOf(typeof instance === 'function' ? instance : instance.constructor);
52 return parent.name ? parent : undefined;
53}
54
55export function classOf(instance: AribtraryObject | Constructor): Constructor | undefined {
56 return instance ? typeof instance === 'function' ? // is it a JavaScript function of some kind?

Callers 2

typeOfFunction · 0.85
hierarchyFunction · 0.85

Calls 1

nullishMethod · 0.80

Tested by

no test coverage detected