get multimethod
Methods
- get(arr:Arr, idx:Int, dflt:Any)
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
AnyExample
[1,2,3].get(0, 10) # 1 [1,2,3].get(5, 10) # 10
- get(h:Hash, k:Any, dflt:Any)
Get hash value by key or dflt if it does not exist Returns
AnyExample
h = {"a": 1} h.get("a", 10) # 1 h.get("b", 10) # 10
- get(al:ArrLike, idx:Int, dflt:Any) Source: stdlib.ngs:663
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:711
Get value by key or dflt if it does not exist Returns
Any
- get(hl:HashLike, k:Any) Source: stdlib.ngs:715
Get value by key or null if it does not exist Returns
Any
- get(h:Hash, k:Any) Source: stdlib.ngs:1422
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:1470
Return array made of given field of each element of given Eachable1 where present Returns
ArrExample
[{"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:1478
Return array made of given field of each element of given Eachable1 where present or default value where the field is not present. Returns
ArrExample
[{"x": 1}, {"y": 2}].get("x", null) # [1, null]
- get(fb:FullBox, dflt:Any=null) Source: stdlib.ngs:2769
Get FullBox value Returns
AnyExample
Box(10).get() # 10
- get(eb:EmptyBox) Source: stdlib.ngs:2772
Get EmptyBox value. Always throws BoxFail.
- get(eb:EmptyBox, dflt:Any) Source: stdlib.ngs:2778
Get EmptyBox value Returns
dflt
- get(s:Success) Source: stdlib.ngs:2902
Gets wrapped value Returns
AnyExample
{ 1 / 10 }.Result().get() # 0
- get(f:Failure) Source: stdlib.ngs:2907
Throws ResultFail Example
{ 1 / 0 }.Result().get() # ResultFail exception
- get(s:Success, dflt:Any) Source: stdlib.ngs:2913
Gets wrapped value Returns
AnyExample
{ 1 / 10 }.Result().get(100) # 0
- get(f:Failure, dflt:Any) Source: stdlib.ngs:2917
Retruns dflt Example
{ 1 / 0 }.Result().get(100) # 100