Skip to content
This repository was archived by the owner on May 26, 2021. It is now read-only.

Obj.API

Lee Tagg edited this page Aug 24, 2015 · 1 revision

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:
  • Tutorial: obj.apply
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:
  • Tutorial: obj.clone
Returns:

A clone of the objectToClone

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:
  • Tutorial: obj.is
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:
  • Tutorial: obj.merge
Returns:

The first object with the properties from the second object merged into the properties of the first

Type
object

Generated with wicked.