MCPcopy Create free account
hub / github.com/pollinations/pollinations / parseBooleanLike

Function parseBooleanLike

gen.pollinations.ai/src/util.ts:43–52  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

41 * (z.coerce.boolean() treats the string "false" as true.)
42 */
43export function parseBooleanLike(value: unknown): boolean | null {
44 if (typeof value === "boolean") return value;
45 if (typeof value === "number") return value !== 0;
46 if (typeof value !== "string") return null;
47
48 const normalized = value.trim().toLowerCase();
49 if (TRUE_TOKENS.includes(normalized)) return true;
50 if (FALSE_TOKENS.includes(normalized)) return false;
51 return null;
52}

Callers 3

extractStreamRequestedFunction · 0.90
text.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected