MCPcopy Create free account
hub / github.com/atomicdata-dev/atomic-data-browser / valToBoolean

Function valToBoolean

lib/src/value.ts:25–30  ·  view source on GitHub ↗
(val: JSONValue)

Source from the content-addressed store, hash-verified

23
24/** Tries to make a boolean from this value. Throws if it is not a boolean. */
25export function valToBoolean(val: JSONValue): boolean {
26 if (typeof val !== 'boolean') {
27 throw new Error(`Not a boolean: ${val}, is a ${typeof val}`);
28 }
29 return val;
30}
31
32/**
33 * Tries to convert the value (timestamp or date) to a JS Date. Throws an error

Callers 1

useBooleanFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected