Commit e30738a0 authored by Thomas Urban's avatar Thomas Urban

fixing deep-merge

parent afdd044d
......@@ -49,6 +49,9 @@ function _merge( dest, ...sources ) {
function _submerge( dst, srcList, path ) {
for ( let sourceIndex = 0, numSources = srcList.length; sourceIndex < numSources; sourceIndex++ ) {
const source = srcList[sourceIndex];
if ( !source ) {
continue;
}
const keys = Object.keys( source );
for ( let keyIndex = 0, numKeys = keys.length; keyIndex < numKeys; keyIndex++ ) {
......@@ -59,7 +62,7 @@ function _merge( dest, ...sources ) {
switch ( typeof value ) {
case "object" :
if ( value && !Array.isArray( value ) ) {
if ( value && value.constructor.name === "Object" ) {
if ( !dst.hasOwnProperty( key ) ) {
dst[key] = {};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment