diff options
| author | Misko Hevery | 2010-05-10 10:36:06 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-05-10 10:36:06 -0700 |
| commit | f5027cc375cf29d8a78679297d9f6bdca9567eb7 (patch) | |
| tree | f415af2b615656562c1d1ac10fe9b4aab83b54c7 /src/Angular.js | |
| parent | 4542716370ac52f385795f509436104a2a3501d2 (diff) | |
| parent | 664f1c56876f00b885272c39f759641271eef1dc (diff) | |
| download | angular.js-f5027cc375cf29d8a78679297d9f6bdca9567eb7.tar.bz2 | |
Merge branch 'master' of github.com:angular/angular.js
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Angular.js b/src/Angular.js index 3af21ced..2df6bbef 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -231,13 +231,14 @@ function isLeafNode (node) { function copy(source, destination){ if (!destination) { - if (isArray(source)) { - return copy(source, []); - } else if (isObject(source)) { - return copy(source, {}); - } else { - return source; + if (source) { + if (isArray(source)) { + return copy(source, []); + } else if (isObject(source)) { + return copy(source, {}); + } } + return source; } else { if (isArray(source)) { while(destination.length) { @@ -249,7 +250,11 @@ function copy(source, destination){ }); } foreach(source, function(value, key){ - destination[key] = isArray(value) ? copy(value, []) : (isObject(value) ? copy(value, {}) : value); + destination[key] = value ? + ( isArray(value) ? + copy(value, []) : + (isObject(value) ? copy(value, {}) : value)) : + value; }); return destination; } |
