MCPcopy Index your code
hub / github.com/mobxjs/mobx / createInstanceofPredicate

Function createInstanceofPredicate

packages/mobx/src/utils/utils.ts:132–141  ·  view source on GitHub ↗
(
    name: string,
    theClass: new (...args: any[]) => T
)

Source from the content-addressed store, hash-verified

130}
131
132export function createInstanceofPredicate<T>(
133 name: string,
134 theClass: new (...args: any[]) => T
135): (x: any) => x is T {
136 const propName = "isMobX" + name
137 theClass.prototype[propName] = true
138 return function (x) {
139 return isObject(x) && x[propName] === true
140 } as any
141}
142
143/**
144 * Yields true for both native and observable Map, even across different windows.

Callers 8

observablevalue.tsFile · 0.85
observablemap.tsFile · 0.85
observablearray.tsFile · 0.85
observableset.tsFile · 0.85
reaction.tsFile · 0.85
computedvalue.tsFile · 0.85
atom.tsFile · 0.85

Calls 1

isObjectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…