Class: Merger

semantic-merge~ Merger

This is the Merger. It is implemented as a class, but you do not need to use it as one - simply call the constructor function as you would call any other function and you get the results you would expect.

Constructor

new Merger(source)

Create a new merger

If called without new, it will create a new instance anyway.

Parameters:
Name Type Description
source Object

The object to be merged

Source:

Members

recursively

Semantic getter to enable recursive merge

By default, only shallow merge is performed. That means, if an object's property is also an object, it will be copied by reference. To avoid this, call this getter somewhere in your call chain (before you call into())

Default Value:
  • this
Source:
Tutorials:

Methods

and(source) → {this}

Add another source object to be merged

Parameters:
Name Type Description
source Object

The object to be merged

Source:
Returns:
Type
this

except() → {this}

Alias of excluding()

Source:
Tutorials:
Returns:
Type
this

excluding(properties) → {this}

While merging, ignore properties with this name

Parameters:
Name Type Description
properties String | Array

A single property or an array of properties to be ignored. This will be used on all recursive levels of merging.

Source:
Tutorials:
Returns:
Type
this

into(target) → {Object}

Set the target object to merge into and perform the actual merge

This should be the last method called.

Parameters:
Name Type Description
target Object

The object to start merging into

Source:
Returns:

Returns the merged object

Type
Object