merge.js
function getInitialValue(type, adapter)
{
  var value
    // should be either `window` or `global`
    , glob       = typeof window == 'object' ? window : global
    // capitalize the first letter to make object constructor
    , objectType = type[0].toUpperCase() + type.substr(1)
    ;

  if (typeof adapter.initialValue == 'function')
  {
    value = adapter.initialValue();
  }
  else if (objectType in glob)
  {
    // create new type object and get it's actual value
    // e.g. `new String().valueOf() // -> ''`
    value = new glob[objectType]().valueOf();
  }

  // set initial value as `undefined` if no initialValue method found
  return value;
}
function getInitialValue(type, adapter)
{
  var value
    // should be either `window` or `global`
    , glob       = typeof window == 'object' ? window : global
    // capitalize the first letter to make object constructor
    , objectType = type[0].toUpperCase() + type.substr(1)
    ;

  if (typeof adapter.initialValue == 'function')
  {
    value = adapter.initialValue();
  }
  else if (objectType in glob)
  {
    // create new type object and get it's actual value
    // e.g. `new String().valueOf() // -> ''`
    value = new glob[objectType]().valueOf();
  }

  // set initial value as `undefined` if no initialValue method found
  return value;
}
function getInitialValue ( type , adapter ) { var value // should be either `window` or `global` , glob = typeof window == 'object' ? window : global // capitalize the first letter to make object constructor , objectType = type [ 0 ] . toUpperCase ( ) + type . substr ( 1 ) ; if ( typeof adapter . initialValue == 'function' ) { value = adapter . initialValue ( ) ; } else if ( objectType in glob ) { // create new type object and get it's actual value // e.g. `new String().valueOf() // -> ''` value = new glob [ objectType ] ( ) . valueOf ( ) ; } // set initial value as `undefined` if no initialValue method found return value ; }
Creates initial value for the provided type

@param   {string} type - type to create new value of
@param   {function} adapter - adapter function with custom `initialValue` method
@returns {mixed} - new value of the requested type
Creates initial value for the provided type