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

Function keys

packages/mobx/src/api/object-api.ts:21–34  ·  view source on GitHub ↗
(obj: any)

Source from the content-addressed store, hash-verified

19export function keys<T>(set: ObservableSet<T>): ReadonlyArray<T>
20export function keys<T extends Object>(obj: T): ReadonlyArray<PropertyKey>
21export function keys(obj: any): any {
22 if (isObservableObject(obj)) {
23 return (
24 (obj as any as IIsObservableObject)[$mobx] as ObservableObjectAdministration
25 ).keys_()
26 }
27 if (isObservableMap(obj) || isObservableSet(obj)) {
28 return Array.from(obj.keys())
29 }
30 if (isObservableArray(obj)) {
31 return obj.map((_, index) => index)
32 }
33 die(5)
34}
35
36export function values<K, T>(map: ObservableMap<K, T>): ReadonlyArray<T>
37export function values<T>(set: ObservableSet<T>): ReadonlyArray<T>

Callers 5

proxies.jsFile · 0.90
valuesFunction · 0.85
entriesFunction · 0.85
object-api.jsFile · 0.85
object-api.jsFile · 0.85

Calls 6

isObservableMapFunction · 0.85
dieFunction · 0.85
keys_Method · 0.80
isObservableObjectFunction · 0.50
isObservableArrayFunction · 0.50
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…