MCPcopy Create free account
hub / github.com/middleapi/orpc / getConstructor

Function getConstructor

packages/shared/src/object.ts:32–39  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

30 *
31 */
32export function getConstructor(value: unknown): Function | null | undefined { // eslint-disable-line ts/no-unsafe-function-type
33 // Object.getPrototypeOf require object in node.js
34 if (!isTypescriptObject(value)) {
35 return null
36 }
37
38 return Object.getPrototypeOf(value)?.constructor
39}
40
41/**
42 * Check if the value is an object even it created by `Object.create(null)` or more tricky way.

Callers 2

[Symbol.hasInstance]Method · 0.90
object.test.tsFile · 0.90

Calls 1

isTypescriptObjectFunction · 0.85

Tested by

no test coverage detected