Class: Obj

Obj

new Obj()

A bare minimum set of utilities for working with objects
Source:

Methods

apply(first, second) → {object}

Mutates the first object by deeply applying the properties from the second object onto the properties of the first object only if the properties already exist on the first object. This overwrites existing properties but ignores new ones. If the desire isn't to mutate the first object, use clone(first).
Parameters:
Name Type Description
first object The first and mutable object
second object The second object
Source:
Tutorials:
Returns:
The first object with the second objects properties applied to it
Type
object

clone(objectToClone) → {object}

Perform a deep clone of two objects
Parameters:
Name Type Description
objectToClone object the object to be cloned
Source:
Tutorials:
Returns:
A clone of the objectToClone
Type
object

defaults(first, second) → {object}

behaves identically to apply() apart from when the second value is undefined defaults will return the first value. No error will be thrown
Parameters:
Name Type Description
first object The first and mutable object
second object The second object
Source:
Tutorials:
Returns:
The first object with the second objects properties applied to it
Type
object

is(object, typeAssertion) → {boolean}

Returns true if the specified object is of type typeAssertion or it's constructor name is of the type specified by the typeAssertion
Parameters:
Name Type Description
object * Any value with a prototype
typeAssertion String A string representing the name of the expected type
Source:
Tutorials:
Returns:
True|False based on the truthiness of the typeAssertion
Type
boolean

merge(first, second) → {object}

Mutates the first object by deeply merging the properties of the second object into the first object, overwriting the properties already set on the first specifically passing properties by reference. If the desire isn't to mutate the first object, use clone(first).
Parameters:
Name Type Description
first object the first and mutable object
second object the second object
Source:
Tutorials:
Returns:
The first object with the properties from the second object merged into the properties of the first
Type
object