esco/superhash

View on GitHub
API.md

Summary

Maintainability
Test Coverage

* [`SuperHash(entries)`](#superhashentries)
* [`set(keys, value)`](#setkeys-value)
* [`get(keys)`](#getkeys)
* [`has(keys)`](#haskeys)
* [`keys`](#keys)
* [`entries`](#entries)
* [`values`](#values)
* [`forEach(cb, context)`](#foreachcb-context)
* [`delete(keys)`](#deletekeys)
* [`clear`](#clear)

### `SuperHash(entries)`
* **entries** (`Array`) two dimensional array with entries to prefill the map. Keys must be an array (even if just one)

Creates a new SuperHash

 Example `entries` Array

```
[[1,2,3],'foo'], [[{foo: 'bar', {blip:'blop'}],'bar']]
```
### `set(keys, value)`
* **keys** (`...*`) Used to generate hash
* **value** (`*`) to be associated with the key

Creates a hash from the keys if it doesn't exist and sets the last argument passed in as the value
### `get(keys)`
* **keys** (`...*`) Used to generate a hash for lookup

Returns the value associated with the hash generated from the keys
### `has(keys)`
* **keys** (`...*`) - Used to generate a hash for lookup

Tells whether or not value associated with the hash generated from the keys is in the map
### `keys`

Returns all keys from the hash map
### `entries`

Returns all entries (key/value pairs) from the hash map
### `values`

Returns all values from the hash map
### `forEach(cb, context)`
* **cb** (`Function`) callback function called with `(key, value)` for each entry in the map
* **context** (`*`) `this` context for the callback 

Loops through each value in the hashmap passing it as the first argument in callack

```js
hashMap.forEach(function(value){
  
});
```
### `delete(keys)`
* **keys** (`...*`) - Used to generate a hash for lookup

Removes the hash generated by the keys and the associated value
### `clear`

Deletes all keys and values from hash map