Object
Methods
clone(obj) → {Object} static
Returns a (deep) clone of the given Object or Array.
Parameters:
Name Type Description obj Object Object to clone.
Returns:
The cloned object.
contains(obj, key, value) → {Boolean} static
Check whether or not the given key or value is contained within the object.
Parameters:
Name Type Argument Default Description obj Object Object to check.
key String Key to check for.
value Boolean optional false Check object for value instead of key.
Returns:
True when key is in object. False otherwise.
create(prototype) → {Object} static
Creates a new object with the specified prototype object and properties.
Parameters:
Name Type Description prototype Object Object to use as prototype.
Returns:
The newly constructed object.
each(obj, callback, scope) static
Iterate over each of objects properties, but returns when the provided callback returns false.
Parameters:
Name Type Argument Default Description obj Object Object to iterate over.
callback function Function to use as callback.
Properties
Name Type Description key String The key that callback is invoked with.
value * The value that callback is invoked with.
obj Object The object that is iterated over.
scope Object optional obj Object to use as this when invoking callback.
flip(obj) → {Object} static
Flips all keys and values in object. Keys become values and vice versa.
Parameters:
Name Type Description obj Object Object to flip.
Returns:
Returns the flipped object.
forEach(obj, callback, scope) static
Iterate over each of objects properties.
Parameters:
Name Type Argument Default Description obj Object Object to iterate over.
callback function Function to use as callback.
Properties
Name Type Description key String The key that callback is invoked with.
value * The value that callback is invoked with.
obj Object The object that is iterated over.
scope Object optional obj Object to use as this when invoking callback.
getFromPath(obj, parts) → {*} static
Gets the value from object's given path or null if the path is not valid.
Parameters:
Name Type Description obj Object Object to walk.
parts String | Array Path to take when walking the object.
Returns:
The value from the specified path.
indexOf(obj, value) → {*} static
Check whether a value exists in object or not.
Parameters:
Name Type Description obj Object Object to search in.
value function value to search for in object.
Returns:
Returns true when found or undefined when not found.
is(value1, value2) → {Boolean} static
Determines whether two values are the same value.
Parameters:
Name Type Description value1 * The first value to compare.
value2 * The second value to compare.
Returns:
A Boolean indicating whether or not the two arguments are the same value.
keyOf(obj, key) → {*} static
Check whether a key exists in object or not.
Parameters:
Name Type Description obj Object Object to search in.
key String Key to search for in object.
Returns:
Returns key when found or undefined when not found.
keys(obj) → {Array} static
Returns all keys from the object as array.
Parameters:
Name Type Description obj Object Object of which to get the keys.
Returns:
Returns the keys as array.
merge(obj) → {Object} static
Merges n objects into one.
Parameters:
Name Type Argument Description obj Object repeatable Object(s) to merge.
Returns:
A newly created object.
sort(obj) → {Object} static
Sorts object by it's keys.
Parameters:
Name Type Description obj Object Object of which the keys should be sorted.
Returns:
The sorted object.