get multimethod

Methods

get(h:Hash, k:Any, dflt:Any)
Get hash value by key or dflt if it does not exist

Returns

Any

Example

h = {"a": 1}
h.get("a", 10)  # 1
h.get("b", 10)  # 10
get(ms:MatchSuccess) Source: stdlib.ngs:759
Get the values of successful match
get(mf:MatchFailure) Source: stdlib.ngs:762
Throws ResultFail
get(al:ArrLike, idx:Int, dflt:Any) Source: stdlib.ngs:1509
Get element at the given index or return dflt if the index is out of range (element at the given index does not exist). See get(Arr).
get(hl:HashLike, k:Any, dflt:Any) Source: stdlib.ngs:1648
Get value by key or dflt if it does not exist

Returns

Any
get(hl:HashLike, k:Any) Source: stdlib.ngs:1652
Get value by key or null if it does not exist

Returns

Any
get(h:Hash, k:Any) Source: stdlib.ngs:2402
Get hash value by key or null if it does not exist

Example

h = {"a": 1}
h.get("a")  # 1
h.get("b")  # null
get(e:Eachable1, field:Str) Source: stdlib.ngs:2438
Return array made of given field of each element of given Eachable1 where present

Returns

Arr

Example

[{"x": 1}, {"y": 2}].get("x")  # [1]
``aws ec2 describe-instances``.Tags.get("role").uniq()
# Returns Arr of Str with roles. Does not crash if some machines do not have "role" tag.
get(e:Eachable1, field:Str, dflt:Any) Source: stdlib.ngs:2446
Return array made of given field of each element of given Eachable1 where present or default value where the field is not present.

Returns

Arr

Example

[{"x": 1}, {"y": 2}].get("x", null)  # [1, null]
get(a:Arr, idx:Int, dflt:Any=null) Source: stdlib.ngs:2463
Get element at the given index or return dflt if the index is out of range (element at the given index does not exist)

Returns

Any

Example

[1,2,3].get(0, 10)    # 1
[1,2,3].get(5, 10)    # 10
[11].get(-1)          # 11
[10,20].get(-5, "X")  # "X"
get(fb:FullBox, dflt:Any=null) Source: stdlib.ngs:3794
Get FullBox value

Returns

Any

Example

Box(10).get()  # 10
get(eb:EmptyBox) Source: stdlib.ngs:3797
Get EmptyBox value. Always throws BoxFail.
get(eb:EmptyBox, dflt:Any) Source: stdlib.ngs:3803
Get EmptyBox value

Returns

dflt
get(s:Success) Source: stdlib.ngs:3950
Gets wrapped value

Returns

Any

Example

{ 1 / 10 }.Result().get()  # 0
get(f:Failure) Source: stdlib.ngs:3955
Throws ResultFail

Example

{ 1 / 0 }.Result().get()  # ResultFail exception
get(s:Success, dflt:Any) Source: stdlib.ngs:3961
Gets wrapped value

Returns

Any

Example

{ 1 / 10 }.Result().get(100)  # 0
get(f:Failure, dflt:Any) Source: stdlib.ngs:3965
Returns dflt

Example

{ 1 / 0 }.Result().get(100)  # 100
get(ms:MatchSuccess, idx:Int, dflt:Any=null) Source: stdlib.ngs:7018
Get indexed match, returning dflt is the match is not found