Permalink
Browse files

fixed bug in m8.merge when deep copying same types merge was not taki…

…ng target properties into consideration
  • Loading branch information...
1 parent bb0c8f0 commit 6a672e807cf8006c475a8a7091af6f3b0cf55701 @constantology committed Sep 10, 2012
Showing with 9 additions and 7 deletions.
  1. +2 −2 m8.js
  2. +1 −1 m8.min.js
  3. +4 −2 package.json
  4. +2 −2 src/lib.js
View
4 m8.js
@@ -188,11 +188,11 @@
}
}
function merge_array( target, source, i ) {
- target[i] = merge( source );
+ target[i] = nativeType( target[i] ) === nativeType( source ) ? merge( target[i], source ) : merge( source );
return target;
}
function merge_object( o, key ) {
- o.target[key] = merge( o.source[key] );
+ o.target[key] = nativeType( o.target[key] ) === nativeType( o.source[key] ) ? merge( o.target[key], o.source[key] ) : merge( o.source[key] );
return o;
}
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -7,9 +7,11 @@
"description" : "m8 is a small utility library you might find useful or just plain annoying.",
"devDependencies" : {
"Templ8" : ">= 0.3.0",
- "chai" : ">= 1.2.0",
+ "chai" : ">= 1.2.7",
"mkdirp" : ">= 0.3.0",
+ "mime" : ">= 1.2.0",
"mocha" : ">= 1.3.0",
+ "n8iv" : ">= 0.2.0",
"uglify-js" : ">= 1.2.5"
},
"engines" : {
@@ -29,5 +31,5 @@
"scripts" : {
"test" : "mocha -c --ignore-leaks -R spec -u tdd ./test/*.test.js"
},
- "version" : "0.2.5"
+ "version" : "0.2.6"
}
View
@@ -137,11 +137,11 @@
}
}
function merge_array( target, source, i ) {
- target[i] = merge( source );
+ target[i] = nativeType( target[i] ) === nativeType( source ) ? merge( target[i], source ) : merge( source );
return target;
}
function merge_object( o, key ) {
- o.target[key] = merge( o.source[key] );
+ o.target[key] = nativeType( o.target[key] ) === nativeType( o.source[key] ) ? merge( o.target[key], o.source[key] ) : merge( o.source[key] );
return o;
}

0 comments on commit 6a672e8

Please sign in to comment.