Skip to content

Function: getPath()

Makaio Framework


Makaio Framework / bus-core / getPath

getPath(obj, path): unknown

Defined in: ../../../packages/bus-core/src/utils/payload-filter.ts:23

Get a nested value from an object using dot-notation path.

unknown

Object to traverse

string

Dot-notation path (e.g., ‘raw.msg.type’)

unknown

Value at path, or undefined if not found

const obj = { raw: { msg: { type: 'event' } } };
getPath(obj, 'raw.msg.type'); // 'event'
getPath(obj, 'raw.missing'); // undefined