MCPcopy Index your code
hub / github.com/immutable-js/immutable-js / get

Function get

src/functional/get.ts:48–63  ·  view source on GitHub ↗
(
  collection: Collection<K, V> | Array<V> | { [key: string]: V },
  key: K,
  notSetValue?: NSV
)

Source from the content-addressed store, hash-verified

46 notSetValue?: NSV
47): V | NSV;
48export function get<K, V, NSV>(
49 collection: Collection<K, V> | Array<V> | { [key: string]: V },
50 key: K,
51 notSetValue?: NSV
52): V | NSV {
53 return isImmutable(collection)
54 ? collection.get(key, notSetValue)
55 : !has(collection, key)
56 ? notSetValue
57 : // @ts-expect-error weird "get" here,
58 typeof collection.get === 'function'
59 ? // @ts-expect-error weird "get" here,
60 collection.get(key)
61 : // @ts-expect-error key is unknown here,
62 collection[key];
63}

Callers 2

updateInDeeplyFunction · 0.90
getInFunction · 0.90

Calls 3

isImmutableFunction · 0.90
hasFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected