(
collection: Collection<K, V> | Array<V> | { [key: string]: V },
key: K,
notSetValue?: NSV
)
| 46 | notSetValue?: NSV |
| 47 | ): V | NSV; |
| 48 | export 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 | } |
no test coverage detected