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

Function assertArray

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

Source from the content-addressed store, hash-verified

82}
83
84export function assertArray(val: Value | null | undefined): asserts val is VArr {
85 if (val == null) {
86 throw new AiScriptRuntimeError('Expect array, but got nothing.');
87 }
88 if (!isArray(val)) {
89 throw new AiScriptRuntimeError(`Expect array, but got ${val.type}.`);
90 }
91}
92
93export function assertNull(val: Value | null | undefined): asserts val is VNull {
94 if (val == null) {

Callers 7

__evalMethod · 0.85
__evalSyncMethod · 0.85
defineMethod · 0.85
primitive-props.tsFile · 0.85
setMethod · 0.85
math.tsFile · 0.85
std.tsFile · 0.85

Calls 1

isArrayFunction · 0.85

Tested by

no test coverage detected