MCPcopy Create free account
hub / github.com/aiscript-dev/aiscript / assertFunction

Function assertFunction

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

Source from the content-addressed store, hash-verified

46}
47
48export function assertFunction(val: Value | null | undefined): asserts val is VFn {
49 if (val == null) {
50 throw new AiScriptRuntimeError('Expect function, but got nothing.');
51 }
52 if (!isFunction(val)) {
53 throw new AiScriptRuntimeError(`Expect function, but got ${val.type}.`);
54 }
55}
56
57export function assertString(val: Value | null | undefined): asserts val is VStr {
58 if (val == null) {

Callers 6

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

Calls 1

isFunctionFunction · 0.85

Tested by

no test coverage detected