UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

22 lines (21 loc) • 709 B
export function readPath(value, path) { const segments = path.split("."); if (segments.some((segment) => segment === "")) { return undefined; } let current = value; for (const segment of segments) { if (typeof current !== "object" || current === null || Array.isArray(current)) { return undefined; } // Own data properties only: no prototype names, and no getter is run. const descriptor = Object.getOwnPropertyDescriptor(current, segment); if (descriptor === undefined || !("value" in descriptor)) { return undefined; } current = descriptor.value; } return current; }