MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / parseJsonObject

Function parseJsonObject

packages/cli/src/auth/store.ts:355–366  ·  view source on GitHub ↗
(text: string, label: string)

Source from the content-addressed store, hash-verified

353}
354
355function parseJsonObject(text: string, label: string): Record<string, unknown> {
356 let raw: unknown;
357 try {
358 raw = JSON.parse(text);
359 } catch (err) {
360 throw ErrInvalidStore(`invalid JSON: ${(err as Error).message}`);
361 }
362 if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
363 throw ErrInvalidStore(`${label} must be a JSON object`);
364 }
365 return raw as Record<string, unknown>;
366}
367
368function pickNonEmptyString(obj: Record<string, unknown>, key: string): string | undefined {
369 const v = obj[key];

Callers 1

parseJsonStoreFunction · 0.85

Calls 1

ErrInvalidStoreFunction · 0.85

Tested by

no test coverage detected