Class: MultiMap

Maps keys to an array of values. Supports using either Strings or DOM Elements as keys.

If the keys are DOM elements, they can be ordered by setting the lens:multimap:order jQuery data. See also MultiMap.updateOrder, which automatically creates a partial order for an array of elements.

MultiMap() common/util/multi_map.js, line 33

Creates a new MultiMap

Static Methods

MultiMap.updateOrder() common/util/multi_map.js, line 224

Updates the multimap order of the elements in the given list such that no element has an order greater than an element that comes after it.

Instance Methods

delete() common/util/multi_map.js, line 142

Removes the given key from this MultiMap.

each() common/util/multi_map.js, line 151

For each key in this MultiMap that has at least one value, invokes fn(value, keys). If the jquery data for the key element includes a lens:multimap:order property, the keys are sorted by that order.

eachReverse() common/util/multi_map.js, line 160

The same as each, but traverses in reverse order.

every() common/util/multi_map.js, line 171

The same as each, but stops execution if the callback function returns false. Returns true if the callback returned true every time.

everyReverse() common/util/multi_map.js, line 180

The same as every, but traverses in reverse order.

firsts() common/util/multi_map.js, line 190

Returns an array that contains the first value associated with each key in this MultiMap.

get() common/util/multi_map.js, line 88

Gets the array of values associated with a key. This DOES NOT make a copy; modification to the returned array will modify this MultiMap.

include() common/util/multi_map.js, line 110

Returns true iff the given key is in this MultiMap

pairs() common/util/multi_map.js, line 197

Returns a sorted array of [key, value] pairs.

put() common/util/multi_map.js, line 95

Adds the given value to the array of values associated with a key

removeVal() common/util/multi_map.js, line 120

Removes all instances of the given value from the array of values associated with the given key.

size() common/util/multi_map.js, line 204

Returns the number of keys in this map.