Skip to content
MapSVG 8/Documentation

getNestedValue()

function getNestedValue(obj, path): any;

Gets a nested value from an object using dot or PHP-style bracket notation.

ParameterTypeDescription
objanyThe object to traverse.
pathstringThe path string (e.g. ‘a.b.c’ or ‘a[b][c]’).

any

The value at the nested path, or undefined if not found.

getNestedValue(obj, 'a.b.c')
getNestedValue(obj, 'a[b][c]')