MCPcopy Index your code
hub / github.com/aiscript-dev/aiscript / assertBoolean

Function assertBoolean

src/interpreter/util.ts:39–46  ·  view source on GitHub ↗
(val: Value | null | undefined)

Source from the content-addressed store, hash-verified

37}
38
39export function assertBoolean(val: Value | null | undefined): asserts val is VBool {
40 if (val == null) {
41 throw new AiScriptRuntimeError('Expect boolean, but got nothing.');
42 }
43 if (!isBoolean(val)) {
44 throw new AiScriptRuntimeError(`Expect boolean, but got ${val.type}.`);
45 }
46}
47
48export function assertFunction(val: Value | null | undefined): asserts val is VFn {
49 if (val == null) {

Callers 4

__evalMethod · 0.85
__evalSyncMethod · 0.85
primitive-props.tsFile · 0.85
std.tsFile · 0.85

Calls 1

isBooleanFunction · 0.85

Tested by

no test coverage detected