Skip to content
API/readPath

readPath

src/utils/read-path.tsfunction
readPath(response: RawResponse, path: string): unknown

Read a dot-separated path out of a response body.

A bare-array body (PostgREST, WordPress) carries no envelope keys, so every lookup against one resolves to undefined — the same answer callers already expect for a missing key, and the same answer an empty path gives.

Parameter Type Description
response RawResponse The raw response body
path string Dot-separated path, e.g. meta.pagination.total

Returns — The value at that path, or undefined if absent