MCPcopy Create free account
hub / github.com/everx-labs/everdev / expectIf

Method expectIf

src/controllers/contract/param-parser.ts:52–65  ·  view source on GitHub ↗
(
        test: (c: string) => boolean,
        param: AbiParam,
        expectMessage: string,
    )

Source from the content-addressed store, hash-verified

50 }
51
52 expectIf(
53 test: (c: string) => boolean,
54 param: AbiParam,
55 expectMessage: string,
56 ): string {
57 const passed = this.passWhile(test)
58
59 if (passed !== undefined) {
60 return passed
61 }
62 throw this.error(
63 `Param ${param.name} (${param.type}) expect ${expectMessage}`,
64 )
65 }
66
67 expect(test: string, param: AbiParam): string {
68 return this.expectIf(x => x === test, param, `"${test}"`)

Callers 3

expectMethod · 0.95
parseScalarMethod · 0.95
parseComponentsMethod · 0.95

Calls 2

passWhileMethod · 0.95
errorMethod · 0.95

Tested by

no test coverage detected