Object

Methods

clone(obj) → {Object} static

Returns a (deep) clone of the given Object or Array.

Parameters:

NameTypeDescription
objObject

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:

NameTypeArgumentDefaultDescription
objObject

Object to check.

keyString

Key to check for.

valueBooleanoptional 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:

NameTypeDescription
prototypeObject

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:

NameTypeArgumentDefaultDescription
objObject

Object to iterate over.

callbackfunction

Function to use as callback.

Properties
NameTypeDescription
keyString

The key that callback is invoked with.

value*

The value that callback is invoked with.

objObject

The object that is iterated over.

scopeObjectoptional 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:

NameTypeDescription
objObject

Object to flip.

Returns:

Returns the flipped object.

forEach(obj, callback, scope) static

Iterate over each of objects properties.

Parameters:

NameTypeArgumentDefaultDescription
objObject

Object to iterate over.

callbackfunction

Function to use as callback.

Properties
NameTypeDescription
keyString

The key that callback is invoked with.

value*

The value that callback is invoked with.

objObject

The object that is iterated over.

scopeObjectoptional 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:

NameTypeDescription
objObject

Object to walk.

partsString | 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:

NameTypeDescription
objObject

Object to search in.

valuefunction

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:

NameTypeDescription
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:

NameTypeDescription
objObject

Object to search in.

keyString

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:

NameTypeDescription
objObject

Object of which to get the keys.

Returns:

Returns the keys as array.

merge(obj) → {Object} static

Merges n objects into one.

Parameters:

NameTypeArgumentDescription
objObjectrepeatable 

Object(s) to merge.

Returns:

A newly created object.

sort(obj) → {Object} static

Sorts object by it's keys.

Parameters:

NameTypeDescription
objObject

Object of which the keys should be sorted.

Returns:

The sorted object.

toQueryString(object) → {String} static

Parses (recursivly) the given object into a url query string.

Parameters:

NameTypeDescription
objectObject

Object to parse.

Returns:

The created query string.

values(obj) → {Array} static

Returns all values from the object as array.

Parameters:

NameTypeDescription
objObject

Object of which to get the values.

Returns:

Returns the values as array.