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

Function assertNumber

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

Source from the content-addressed store, hash-verified

64}
65
66export function assertNumber(val: Value | null | undefined): asserts val is VNum {
67 if (val == null) {
68 throw new AiScriptRuntimeError('Expect number, but got nothing.');
69 }
70 if (!isNumber(val)) {
71 throw new AiScriptRuntimeError(`Expect number, but got ${val.type}.`);
72 }
73}
74
75export function assertObject(val: Value | null | undefined): asserts val is VObj {
76 if (val == null) {

Callers 8

__evalMethod · 0.85
__evalSyncMethod · 0.85
getReferenceMethod · 0.85
getReferenceSyncMethod · 0.85
primitive-props.tsFile · 0.85
mergeFunction · 0.85
math.tsFile · 0.85
std.tsFile · 0.85

Calls 1

isNumberFunction · 0.85

Tested by

no test coverage detected