HashLike type
Direct parent types
- Eachable2
Eachable which each() calls the callback with two arguments Direct subtypes: 2
Direct children types
- Hook
Hook is a simple pub-sub
- Stats
A group of named counters
Methods
- .(hl:HashLike, k:Any) Source: stdlib.ngs:702
Get value by key. Throws KeyNotFound. Automatically called by NGS for syntax
your_hashlike.literal_key
Returns
Any
- .=(hl:HashLike, k:Any, v:Any) Source: stdlib.ngs:707
Set value. Automatically called by NGS for syntax
your_hashlike.literal_key = v
Returns
v
- [](hl:HashLike, k:Any) Source: stdlib.ngs:693
Get value by key. Throws KeyNotFound. Automatically called by NGS for syntax
your_hashlike[k]
- []=(hl:HashLike, k:Any, v:Any) Source: stdlib.ngs:697
Set value. Automatically called by NGS for syntax
your_hashlike[k] = v
- Bool(hl:HashLike) Source: stdlib.ngs:735
Check whether hl has any elements. Returns
Bool
- dflt(hl:HashLike, k:Any, v:Any) Source: stdlib.ngs:984
Set a key if it's not already set Returns
Key value, the already-existed or new.Example
mysomething.dflt(k, []).push(elt)
- each(hl:HashLike, cb:Fun) Source: stdlib.ngs:721
Iterate over keys and values. Returns
hlExample
my_hashlike.each(F(k, v) echo("$k=$v"))
- filter(hl:HashLike, predicate:Fun) Source: stdlib.ngs:744
Filter hash. Build new HashLike with kev-value pairs selected by predicate. Parameters
predicate Test function to be called with one key and one value at a time. Returns
HashLikeExample
my_hashlike.filter(F(k, v) k == 'a')
- 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
- Hash(hl:HashLike) Source: stdlib.ngs:762
Get the underlying Hash with all the keys/values of the HashLike. Note: the returned value is not a copy. Returns
Hash
- in(k:Any, hl:HashLike) Source: stdlib.ngs:684
Check whether k is in the HashLike Returns
Bool
- init(hl:HashLike, h:Hash=null) Source: stdlib.ngs:753
Create a HashLike. Parameters
h If provided, used as initial value. Example
HashLike(%{a aha b bee}) # <HashLike a=aha b=bee>
- keys(hl:HashLike) Source: stdlib.ngs:727
Get keys Returns
Arr
- len(hl:HashLike) Source: stdlib.ngs:688
Get number of key-value pairs in a HashLike Returns
Int
- map_idx_key_val(hl:HashLike, mapper:Fun) Source: stdlib.ngs:737
Undocumented
- values(hl:HashLike) Source: stdlib.ngs:731
Get values Returns
Arr