get_at_path

function
yoltra/diff.py:231
signature
get_at_path(obj, path): any

Read the value at a dotted path, or `None` if the path does not resolve. Navigates mappings (by key, falling back to an integer key when the segment is numeric — paths record `str(key)`), sequences (by integer index), and objects (by attribute, for dataclass/Pydantic fields). A leading dot is ignored. Mirrors the TS getter's "returns undefined on a dead path" behavior.

Parameters

NameTypeDescription
objanyRoot value (a slice or nested value).
NameTypeDescription
pathstrDotted path; `""` returns `obj` unchanged.

Returns

anyThe value at `path`, or `None` if any segment does not resolve.