MCPcopy Create free account
hub / github.com/api3dao/airnode / castBoolean

Function castBoolean

packages/airnode-adapter/src/response-processing/casting.ts:36–49  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

34}
35
36function castBoolean(value: unknown): boolean {
37 switch (value) {
38 case 0:
39 case '0':
40 case false:
41 case 'false':
42 case undefined:
43 case null:
44 return false;
45
46 default:
47 return true;
48 }
49}
50
51// Objects and arrays convert to "[object Object]" which isn't very useful
52function assertValueIsNotArrayOrObject(value: unknown) {

Callers 1

castValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected