Skip to content

Latest commit

 

History

History
executable file
·
62 lines (46 loc) · 1.71 KB

API.md

File metadata and controls

executable file
·
62 lines (46 loc) · 1.71 KB

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

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