Methods
hashify(arrayOrSet)
Parameters:
Name | Type | Description |
---|---|---|
arrayOrSet |
* | an composed preferably of strings or a Set. |
Returns:
a "saco" or bag that counts the number of repeated elements
incrementOrInit(hash, key)
Initializes a hash value for a key if it does not exist, increments if it does
Parameters:
Name | Type | Description |
---|---|---|
hash |
* | hash to be mutated |
key |
* | key whose value is going to be set or changed |
Returns:
the new version of the hash
sacoIntersection(unSaco, otroSaco) → {Object}
Intersection of "sacos", retuns an array that uses keys common to both sacos, with the minimum value. Non-compatible objects will work as emmpty sacos; simple arrays will act as sets with as many numeric different elements as elements in the array; thus, [1,2] will have a "0" element that appears 1 and an "1" element that appears 2 times.
Parameters:
Name | Type | Description |
---|---|---|
unSaco |
* | first saco |
otroSaco |
* | second saco |
Returns:
merged "saco"
- Type
- Object
sacoUnion(unSaco, otroSaco) → {Object}
Union of "sacos", retuns an array that uses keys from both sacos and adds their values
Parameters:
Name | Type | Description |
---|---|---|
unSaco |
* | first saco |
otroSaco |
* | second saco |
Returns:
merged "saco"
- Type
- Object
valOr0(hash, key)
Value or 0, returns the value corresponding to a key if it exists, 0 if it does not.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Object | a hash, associative array or Object |
key |
String | A string representing a key, present or not in the hash |
Returns:
value corresponding to the `key`or 0 if it does not exist