AnyOf type
Direct parent types
- ArrLike
Parent type for user-defined types with array-like behaviour. Use in cases when you would like to inherit from built-in Arr. Inheriting from built-ins is not possible for now. Direct subtypes: 6
Methods
- =~(x:Any, a:AnyOf, mc:MatchContext) Source: stdlib.ngs:1974
Check whether one of the patterns (elements of AnyOf) matches Example
{"k1": "v1", "k2": "v2", "k3": "v3"}.filterk(AnyOf("k1", "k3")) # {"k1": "v1", "k3": "v3"}
- Bool(a:AnyOf) Source: stdlib.ngs:1979
Checks whether any of the items are truthy.
- code(a:AnyOf) Source: stdlib.ngs:1986
Convert to NGS code that would produce the type. Not fully functional yet. Namespaces are not supported. Returns
Str
- init(a:AnyOf, *alternatives:Arr) Source: stdlib.ngs:1955
Initializes AnyOf with the given alternatives.
- tr(x:Any, a:AnyOf, tc:TrContext)
Match / transform x using the pattern in a. First match shortcuts the evaluation: further items in a are not tried. Returns
Lit or TrNoMatch
- ~(x:Any, a:AnyOf) Source: stdlib.ngs:1960
Checks whether x matches (~) any of the alternatives.