MCPcopy
hub / github.com/callstack/agent-device / readNullable

Function readNullable

src/utils/parsing.ts:26–33  ·  view source on GitHub ↗
(
  record: Record<string, unknown>,
  key: string,
  parse: (value: unknown) => T | undefined,
)

Source from the content-addressed store, hash-verified

24}
25
26function readNullable<T>(
27 record: Record<string, unknown>,
28 key: string,
29 parse: (value: unknown) => T | undefined,
30): T | null | undefined {
31 const value = record[key];
32 return value === null ? null : parse(value);
33}
34
35export function readRequiredString(record: Record<string, unknown>, key: string): string {
36 return readRequired(record, key, parseNonEmptyString, `Daemon response is missing "${key}".`);

Callers 1

readNullableStringFunction · 0.85

Calls 1

parseFunction · 0.70

Tested by

no test coverage detected