=~ multimethod

Methods

=~(x:Any, pattern:Any) Source: stdlib.ngs:819
Undocumented
=~(x:Any, pattern:Any, _mc:MatchContext) Source: stdlib.ngs:830
Undocumented
=~(x:Any, pa:PatternAction, mc:MatchContext)experimental Source: stdlib.ngs:849
Undocumented
=~(x:Any, bti:BasicTypeInstance, _mc:MatchContext) Source: stdlib.ngs:869
Undocumented

Returns

x == bti
=~(x:Any, ie:IfExists, mc:MatchContext) Source: stdlib.ngs:878
Undocumented
=~(x:Any, h:Hash, mc:MatchContext) Source: stdlib.ngs:887
Checks whether object fields named after h hash keys match (=~) the corresponding hash values. Inspired by underscorejs' "matcher"
=~(x:Any, a:Arr, mc:MatchContext) Source: stdlib.ngs:924
Checks that 1. The x is Eachable1 but not Str or Int 2. Each element of x matches (=~) corresponding element in a (If number of elements does not match - there is no match)
=~(x:Any, f:Fun, _mc:MatchContext) Source: stdlib.ngs:941
Undocumented

Returns

f(x)
=~(x:Any, t:Type, _mc:MatchContext) Source: stdlib.ngs:945
Check whether x is of type t

Returns

x is t
=~(x:Any, l:Lit, _mc:MatchContext) Source: stdlib.ngs:948
Check whether x is the literal value l (using ==)
=~(x:Eachable1, r:Repeat, mc:MatchContext) Source: stdlib.ngs:968
Check that x is a repetition of r.pattern and it occurs r.count times

Returns

Bool
=~(x:Any, n:Not, mc:MatchContext) Source: stdlib.ngs:997
Negate the match

Returns

Bool
=~(x:Any, ap:AtPath, mc:MatchContext) Source: stdlib.ngs:1012
Undocumented
=~(x:Any, rp:ResetPath, mc:MatchContext)experimental Source: stdlib.ngs:1054
Undocumented
=~(x:Any, a:AnyOf, mc:MatchContext) Source: stdlib.ngs:1579
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"}
=~(x:Any, a:AllOf, mc:MatchContext) Source: stdlib.ngs:1603
Checks whether one of the patterns (elements of AllOf) matches

Example

{"k1": "v1", "k2": "v2", "kk3": "vv3"}.filterk(AllOf(/^k/, {len(A) <= 2})) == %{k1 v1 k2 v2}
=~(x:Any, nr:NumRange, _mc:MatchContext) Source: stdlib.ngs:2249
Checks whether x is in the range.

Example

1 =~ 0..5  # true
=~(x:Any, p:Present, mc:MatchContext) Source: stdlib.ngs:4041
Checks element presence.

Returns

Bool

Example

[1,2,3] =~ Present(3)  # MatchSuccess
=~(x:Any, a:Absent, mc:MatchContext) Source: stdlib.ngs:4059
Checks element absence.

Returns

Bool

Example

[1,2,3] =~ Absent(0)  # MatchSuccess
=~(x:DecodeHints, cp:CommandsPipeline, mc:MatchContext) Source: stdlib.ngs:6571
Undocumented
=~(x:Command, c:Command, mc:MatchContext) Source: stdlib.ngs:6584
Match command based on argv and options
=~(x:Eachable1, pfx:Pfx, mc:MatchContext) Source: stdlib.ngs:6989
Undocumented

Example

[1,2,3] =~ Pfx([1,2])
=~(x:Str, s:SubSeq, _mc:MatchContext) Source: stdlib.ngs:7026
Checks subsequence presence

Parameters

sSubSeq of Str

Returns

Bool
=~(x:Any, r:RegExp, _mc:MatchContext) Source: stdlib.ngs:7214
Undocumented

Returns

Checks whether the only argument is of type Str and matches (~) r

Example

%[w1 w2].filter(/1/)  # %[w1]