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

Function assertString

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

Source from the content-addressed store, hash-verified

55}
56
57export function assertString(val: Value | null | undefined): asserts val is VStr {
58 if (val == null) {
59 throw new AiScriptRuntimeError('Expect string, but got nothing.');
60 }
61 if (!isString(val)) {
62 throw new AiScriptRuntimeError(`Expect string, but got ${val.type}.`);
63 }
64}
65
66export function assertNumber(val: Value | null | undefined): asserts val is VNum {
67 if (val == null) {

Callers 7

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

Calls 1

isStringFunction · 0.85

Tested by

no test coverage detected