Class: ParamsDictionary

ParamsDictionary

mmir.tools.ParamsDictionary

A dictionary for parsed URL parameters. If the same parameter occurs multiple times, its values are stored in an array. Parameter values will be indexed by their name, e.g. param=val:
dict["param"] // -> "val"
If the parameter name collides with a dictionary built-in function, it will be prefixed by "&", e.g. has=green:
dict["&has"] // -> "green"
NOTE the dictionary should be treated as read-only: adding / modifying / removing entries may result in an inconsistent state of the dictionary, e.g. w.r.t. #has(key) function etc.
Example
var parseFunc = mmir.require('mmirf/paramsParseFunc');
var dict = parseFunc(document.location.search);
// or:
var dict = mmir.util.parseParamsToDictionary(document.location.search);

var key1 = dict.getKeys()[0];
if(dict.has(key1)){
	if(dict.isMultiple(key1))
		console.log(dict[key1].join(', '));
	else
		console.log(dict[key1]);
}