MCPcopy
hub / github.com/visgl/deck.gl / get

Function get

modules/json/src/utils/get.ts:12–22  ·  view source on GitHub ↗
(container: Record<string, unknown>, compositeKey: string)

Source from the content-addressed store, hash-verified

10 * @return value in the final key of the nested container, or `undefined`
11 */
12export function get(container: Record<string, unknown>, compositeKey: string): unknown {
13 // Split the key into subkeys
14 const keyList = getKeys(compositeKey);
15 // Recursively get the value of each key;
16 let value: Record<string, unknown> | unknown = container;
17 for (const key of keyList) {
18 // If any intermediate subfield is not an object, return undefined
19 value = isObject(value) ? value[key] : undefined;
20 }
21 return value;
22}
23
24/**
25 * Checks if argument is an "indexable" object (not a primitive value, nor null)

Callers 2

parseExpressionStringFunction · 0.90
get.spec.tsFile · 0.90

Calls 2

getKeysFunction · 0.85
isObjectFunction · 0.70

Tested by

no test coverage detected