MCPcopy
hub / github.com/mobxjs/mobx / isObservable

Function isObservable

docs/assets/getting-started-assets/javascripts/mobx.umd.js:379–401  ·  view source on GitHub ↗
(value, property)

Source from the content-addressed store, hash-verified

377 })
378 }
379 function isObservable(value, property) {
380 if (value === null || value === undefined) return false
381 if (property !== undefined) {
382 if (
383 value instanceof ObservableMap ||
384 value instanceof ObservableArray
385 )
386 throw new Error(
387 "[mobx.isObservable] isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."
388 )
389 else if (isObservableObject(value)) {
390 var o = value.$mobx
391 return o.values && !!o.values[property]
392 }
393 return false
394 }
395 return (
396 !!value.$mobx ||
397 value instanceof Atom ||
398 value instanceof Reaction ||
399 value instanceof ComputedValue
400 )
401 }
402 exports.isObservable = isObservable
403 function observableDecorator(target, key, baseDescriptor) {
404 invariant(

Callers 4

observableFunction · 0.70
toJSONFunction · 0.70
makeChildObservableFunction · 0.70

Calls 1

isObservableObjectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…