Function: parseRecord()
parseRecord(
text):Record<string,unknown> |undefined
Parse JSON text that is expected to be an object, returning undefined when
it is absent, malformed, or parses to a non-record (an array, a bare string,
null, …).
This is the common case for manifests, env-var config blobs, and untyped API
payloads: parse followed by isRecord, so the result can be
indexed without an as Record<string, unknown> cast.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Record<string, unknown> | undefined
Example
Section titled “Example”const manifest = json.parseRecord(await readFile("package.json", "utf8")) ?? {};const name = manifest.name;