def alts

ezmcp@0.1.0.0 · src/openapi.bend:1404

import ezmcp@0.1.0.0/src/openapi.bend as Openapi
import Base
import emerging-ezjson@1.2.0.0/main.bend as Json
import emerging-ezjson@1.2.0.0/src/value.bend as Value

1404# whether a value is of one of the `anyOf` alternatives' types
1405def alts(choices: List<&2, Value.Json>, +val: Value.Json) -> Bool:
1406  match choices:
1407    case []:
1408      False{}
1409    case one <> rest:
1410      or.else(typed(Json.get(one, "type"), val), _u => alts(rest, val))

Uses (6)

Used by (1)