src code

class Hash


A set of key/value pairs.

Hash can be thought of as an associative array, binding unique keys to values (which are not necessarily unique), though it can not guarantee consistent order its elements when iterating. Because of the nature of JavaScript, every object is in fact a hash; but Hash adds a number of methods that let you enumerate keys and values, iterate over key/value pairs, merge two hashes together, and much more.

Creating a hash

There are two ways to construct a Hash instance: the first is regular JavaScript object instantiation with the new keyword, and the second is using the $H function. There is one difference between them: if a Hash is passed to $H, it will be returned as-is, wherease the same hash passed to new Hash will be cloned instead.