maps.js is part of Aloha Editor project http://www.alohaeditor.org
Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html
Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html
Methods
-
Clones a map.
Name Type Description map
Object -
Deletes a key from a clone of the given map and returns the clone.
Name Type Description map
Object key
string -
Sets a value on a clone of the given map and returns the clone.
Name Type Description map
Object key
string value
* -
Creates a map without inheriting from Object.
Use this instead of an object literal to avoid having unwanted, inherited
properties on the map.
A map constructed like this allows for the
```for (var key in map) { }```
pattern to be used without a hasOwnProperty check. -
This function is missing documentation.
- TODO
-
- Complete documentation.
-
Fills the given map with the given keys mapped to the given value.
Name Type Description map
Object The given map will have one entry added for each given key. keys
Array.<string> An array of string keys. JavaScript maps can only contain string keys, so these must be strings or they will be cast to string. value
string A single value that each given key will map to. Returns:
given map.
-
Same as Array.filter except for maps.
The given predicate is applied to each entry in the given map,
and only if the predicate returns true, will the entry appear in
the result. -
For each mapping, calls `cb(value, key, m)`.
Like ECMAScript edition 5 Array.forEach but for Maps.
Contrary to "for (key in m)" iterates only over the "hasOwnProperty"
properties of the m, which is usually what you want. -
Checks whether the given object has no own or inherited properties.
Name Type Description obj
Object Object to check. Returns:
if the object is empty. eg: isEmpty({}) == true
-
Whether the given object is a map that can be operated on by
other functions in this module.
We exclude things like new String("..."), new Number(...),
document.createElement(...), but include new MyType("..."). -
Returns an array of the map's keys.
Name Type Description m
Object Returns:
set of keys in `m`.
-
Converts a list of tuples into a hash map key-value pair.
Name Type Description tuples
Array.<Array.<string, *>> -
Merges one or more maps.
Merging happens from left to right, which is useful for example
when merging a number of given options with default options:
var effectiveOptions = Maps.merge(defaults, options);Name Type Description A
Object repeatable variable number of map objects. Returns:
merge of all given maps in a single object.
-
Selects the values for the given keys in the given map.
Name Type Description m
Object ks
Array _default
* used in place of non-existing properties -
Returns an array of the map's values.
Name Type Description m
Object Returns:
values in `m`.