obj.js
Methods
-
staticmodule:obj.assign(target){Object}
-
Object.assign-style object shallow merge/extend.
Name Type Description targetObject ...sourcesObject Returns:
Type Description Object -
staticmodule:obj.each(object, fn)
-
Array-like iteration for objects.
Name Type Description objectObject The object to iterate over
fnobj:EachCallback The callback function which is called for each key in the object.
-
staticmodule:obj.isObject(value){boolean}
-
Returns whether a value is an object of any kind - including DOM nodes, arrays, regular expressions, etc. Not functions, though.
This avoids the gotcha where using
typeofon anullvalue results in'object'.Name Type Description valueObject Returns:
Type Description boolean -
staticmodule:obj.isPlain(value){boolean}
-
Returns whether an object appears to be a "plain" object - that is, a direct instance of
Object.Name Type Description valueObject Returns:
Type Description boolean -
staticmodule:obj.reduce(object, fn, initial){Mixed}
-
Array-like reduce for objects.
Name Type Default Description objectObject The Object that you want to reduce.
fnfunction A callback function which is called for each key in the object. It receives the accumulated value and the per-iteration value and key as arguments.
initialMixed 0 optional Starting value
Returns:
Type Description Mixed The final accumulated value.
Type Definitions
-
obj:EachCallback(value, key)
-
Name Type Description valueMixed The current key for the object that is being iterated over.
keystring The current key-value for object that is being iterated over
-
obj:ReduceCallback(accum, value, key){Mixed}
-
Name Type Description accumMixed The value that is accumulating over the reduce loop.
valueMixed The current key for the object that is being iterated over.
keystring The current key-value for object that is being iterated over
Returns:
Type Description Mixed The new accumulated value.