Skip to main content
variable deepGet
import { deepGet } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Returns the target value in a nested JSON object, based on the keys array.

Compare the keys you want in the nested JSON object as an Array. Use Array.prototype.reduce() to get value from nested JSON object one by one. If the key exists in object, return target value, otherwise, return null.

type

(
obj: any,
keys: string | (string | number)[],
defaultValue?: null | undefined,
delimiter?,
) => unknown