Skip to content
pyautark (soon)

@urban-toolkit/autk-core


@urban-toolkit/autk-core / valueAtPath

Function: valueAtPath()

valueAtPath(item, path): unknown

Defined in: utils-data.ts:22

Resolves a dot-delimited property path from an unknown value.

Parameters

item

unknown

Source value to traverse.

path

string

Dot-delimited property path, for example properties.area.

Returns

unknown

The resolved nested value, or undefined when the path cannot be fully resolved.

Throws

Never throws.

Example

ts
valueAtPath({ a: { b: 42 } }, 'a.b');  // 42
valueAtPath({ a: null }, 'a.b');       // undefined

Released under the MIT License.