lib/index.js
function deepMerge(target, ...sources) {
	let src
	while (true) {
		if (!sources.length)
			return target
		src = sources.shift()
		if (src)
			break
	}

	for (let k in src) {

		let v = src[k]
		let existing = target[k]

		if (typeof v === 'object') {
			if (v === null) {
				target[k] = null
			} else if (Array.isArray(v)) {
				target[k] = v.slice()
			} else {
				if (typeof existing !== 'object')
					target[k] = deepMerge({}, v)
				else
					deepMerge(existing, v)
			}
		} else {
			//v is not object/array
			target[k] = v
		}
	}

	return deepMerge(target, ...sources)
}
function deepMerge(target, ...sources) {
	let src
	while (true) {
		if (!sources.length)
			return target
		src = sources.shift()
		if (src)
			break
	}

	for (let k in src) {

		let v = src[k]
		let existing = target[k]

		if (typeof v === 'object') {
			if (v === null) {
				target[k] = null
			} else if (Array.isArray(v)) {
				target[k] = v.slice()
			} else {
				if (typeof existing !== 'object')
					target[k] = deepMerge({}, v)
				else
					deepMerge(existing, v)
			}
		} else {
			//v is not object/array
			target[k] = v
		}
	}

	return deepMerge(target, ...sources)
}
function deepMerge ( target , ... sources ) { let src while ( true ) { if ( ! sources . length ) return target src = sources . shift ( ) if ( src ) break } for ( let k in src ) { let v = src [ k ] let existing = target [ k ] if ( typeof v === 'object' ) { if ( v === null ) { target [ k ] = null } else if ( Array . isArray ( v ) ) { target [ k ] = v . slice ( ) } else { if ( typeof existing !== 'object' ) target [ k ] = deepMerge ( { } , v ) else deepMerge ( existing , v ) } } else { //v is not object/array target [ k ] = v } } return deepMerge ( target , ... sources ) }
Like Object.assign, but works in a deep manner.

@param	{object}	target - Target object to be merged into
@param	{object}	sources - Source objects to be merged onto target

@return	{object} The target object
Like Object . assign but works in a deep manner .