Dictionary Class
A set of useful functions for manipulating dictionaries.
Item Index
Methods
- clone static
- find static
- forEachEntry static
- isEmpty static
- length static
Methods
clone
-
dict
Returns a shallow copy of the given dictionary.
Parameters:
-
dictObjecta dictionary
Returns:
a shallow copy of the given dictionary
find
-
dict -
fcn -
[compareFcn]
Iterates over the key-value pair in the given dictionary and returns the index of the first element to cause the given fcn to return true.
Parameters:
forEachEntry
-
dict -
fcn -
[sortFcn] -
[scope]
Iterates over the key-value pair in the given dictionary (in arbitrary order) and calls the given function on each key-value pair.
Parameters:
-
dictObjecta dictionary object
-
fcnFunctiona function that takes the following parameters:
- the
key - the
value obj(an optional parameter) that contains two fields, exit and returnVal. If exit is set to true, forEachEntry terminates right away (without iterating over the rest of the dictionary). The return value of forEackKeyValuePair is returnVal (which by default is undefined).
- the
-
[sortFcn]Function optionaltrue if the dictionary keys are to be sorted before iterating
-
[scope]Object optionalThe scope to be hitched to the given fcn
isEmpty
-
dict
Returns true if the given dictionary is empty (i.e. has no keys)
Parameters:
-
dictObjecta dictionary
Returns:
true if the dictionary is empty, false otherwise
length
-
dict
Returns the number of keys in the given dictionary.
Parameters:
-
dictObjecta dictionary
Returns:
the number of keys in the dictionary
