MCPcopy Index your code
hub / github.com/callstack/agent-device / optionalString

Function optionalString

src/commands/command-input.ts:366–373  ·  view source on GitHub ↗
(record: Record<string, unknown>, key: string)

Source from the content-addressed store, hash-verified

364}
365
366function optionalString(record: Record<string, unknown>, key: string): string | undefined {
367 const value = record[key];
368 if (value === undefined) return undefined;
369 if (typeof value !== 'string' || value.length === 0) {
370 throw new Error(`Expected ${key} to be a non-empty string.`);
371 }
372 return value;
373}
374
375export function requiredNumber(record: Record<string, unknown>, key: string): number {
376 const value = record[key];

Callers 3

readCommonInputFunction · 0.70
readInteractionTargetFunction · 0.70
readElementTargetFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…