Module: obj

obj.js

Source:
utils/obj.js

Methods


<static> assign(target)

Object.assign-style object shallow merge/extend.

Parameters:
Name Type Description
target Object
...sources Object
Source:
utils/obj.js
Returns:
Type
Object

<static> each(object, fn)

Array-like iteration for objects.

Parameters:
Name Type Description
object Object

The object to iterate over

fn obj:EachCallback

The callback function which is called for each key in the object.

Source:
utils/obj.js

<static> isObject(value)

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 typeof on a null value results in 'object'.

Parameters:
Name Type Description
value Object
Source:
utils/obj.js
Returns:
Type
Boolean

<static> isPlain(value)

Returns whether an object appears to be a "plain" object - that is, a direct instance of Object.

Parameters:
Name Type Description
value Object
Source:
utils/obj.js
Returns:
Type
Boolean

<static> reduce(object, fn [, initial])

Array-like reduce for objects.

Parameters:
Name Type Argument Default Description
object Object

The Object that you want to reduce.

fn function

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.

initial Mixed <optional>
0

Starting value

Source:
utils/obj.js
Returns:

The final accumulated value.

Type
Mixed

Type Definitions


obj:EachCallback(value, key)

Parameters:
Name Type Description
value Mixed

The current key for the object that is being iterated over.

key string

The current key-value for object that is being iterated over

Source:
utils/obj.js

obj:ReduceCallback(accum, value, key)

Parameters:
Name Type Description
accum Mixed

The value that is accumulating over the reduce loop.

value Mixed

The current key for the object that is being iterated over.

key string

The current key-value for object that is being iterated over

Source:
utils/obj.js
Returns:

The new accumulated value.

Type
Mixed