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

Function parseBooleanValue

src/utils/source-value.ts:99–109  ·  view source on GitHub ↗
(value: unknown, sourceLabel: string, rawKey: string)

Source from the content-addressed store, hash-verified

97}
98
99function parseBooleanValue(value: unknown, sourceLabel: string, rawKey: string): boolean {
100 if (typeof value === 'boolean') return value;
101 if (typeof value === 'string') {
102 const parsed = parseBooleanLiteral(value);
103 if (parsed !== undefined) return parsed;
104 }
105 throw new AppError(
106 'INVALID_ARGS',
107 `Invalid value for "${rawKey}" in ${sourceLabel}. Expected boolean.`,
108 );
109}
110
111export function parseBooleanLiteral(value: string): boolean | undefined {
112 const normalized = value.trim().toLowerCase();

Callers 1

parseSourceValueFunction · 0.85

Calls 1

parseBooleanLiteralFunction · 0.85

Tested by

no test coverage detected