Function: readPath()
function readPath(value: unknown, path: string): unknown;Defined in: src/batteries/orchestration/plan.ts:490
Read a dot-path from a value, with a per-segment prototype-pollution guard.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to read from. |
path | string | A dot-separated path, e.g. 'a.b.c'. |
Returns
unknown
The value at the path, or undefined when the path is missing or refused.
Remarks
This is the prototype-pollution guard, so it is strict. Each path segment is checked against __proto__, prototype and constructor BEFORE it is used as a key; any of those is refused (returns undefined) rather than followed. This prevents a crafted path like a.__proto__.polluted or constructor.prototype.x from reaching the prototype chain. A missing path — a segment that is absent, or a non-object intermediate — returns undefined.
The guard is per-segment, not just on the whole path, because a path is split on . and each segment is a separate key access; a single check on the joined string would miss a segment smuggled past an object boundary. Empty segments (from a leading/trailing dot or a double dot) are treated as missing and return undefined.