merge.js
function merge(to, from)
{
  // if no suitable adapters found
  // just return overriding value
  var result  = from
    , typeOf  = getTypeOfAdapter.call(this)
    , type    = typeOf(from)
    , adapter = getMergeByTypeAdapter.call(this, type)
    ;

  // if target object isn't the same type as the source object,
  // then override with new instance of the same type
  if (typeOf(to) != type)
  {
    to = getInitialValue(type, adapter);
  }

  // bind merge callback to the current context
  // so not to loose runtime flags
  result = adapter.call(this, to, from, merge.bind(this));

  return result;
}
function merge(to, from)
{
  // if no suitable adapters found
  // just return overriding value
  var result  = from
    , typeOf  = getTypeOfAdapter.call(this)
    , type    = typeOf(from)
    , adapter = getMergeByTypeAdapter.call(this, type)
    ;

  // if target object isn't the same type as the source object,
  // then override with new instance of the same type
  if (typeOf(to) != type)
  {
    to = getInitialValue(type, adapter);
  }

  // bind merge callback to the current context
  // so not to loose runtime flags
  result = adapter.call(this, to, from, merge.bind(this));

  return result;
}
function merge ( to , from ) { // if no suitable adapters found // just return overriding value var result = from , typeOf = getTypeOfAdapter . call ( this ) , type = typeOf ( from ) , adapter = getMergeByTypeAdapter . call ( this , type ) ; // if target object isn't the same type as the source object, // then override with new instance of the same type if ( typeOf ( to ) != type ) { to = getInitialValue ( type , adapter ) ; } // bind merge callback to the current context // so not to loose runtime flags result = adapter . call ( this , to , from , merge . bind ( this ) ) ; return result ; }
Merges provided values, utilizing available adapters
if no adapter found, reference to the same object
will be returned, considering it as primitive value

@param   {mixed} to - value to merge into
@param   {mixed} from - value to merge
@returns {mixed} - result of the merge
Merges provided values utilizing available adapters if no adapter found reference to the same object will be returned considering it as primitive value