Permalink
Browse files

Correct bug due to variable name clash.

IMO: this kind of code should be put in an external lib and 100% tested.
  • Loading branch information...
1 parent fbce637 commit dd3d829173d3b3ebbaae41672a7b3b440e4ff851 @virtuo virtuo committed May 21, 2010
Showing with 8 additions and 8 deletions.
  1. +8 −8 lib/socket.io/util/object.js
@@ -2,15 +2,15 @@
// Copyright (c) 2006-2009 Valerio Proietti, <http://mad4milk.net/>
var clone = this.clone = function(item){
- var clone;
+ var cloned;
if (item instanceof Array){
- clone = [];
- for (var i = 0; i < item.length; i++) clone[i] = clone(item[i]);
- return clone;
+ cloned = [];
+ for (var i = 0; i < item.length; i++) cloned[i] = clone(item[i]);
+ return cloned;
} else if (typeof item == 'object') {
- clone = {};
- for (var key in object) clone[key] = clone(object[key]);
- return clone;
+ cloned = {};
+ for (var key in object) cloned[key] = clone(object[key]);
+ return cloned;
} else {
return item;
}
@@ -35,4 +35,4 @@ this.merge = function(source, k, v){
for (var key in object) mergeOne(source, key, object[key]);
}
return source;
-};
+};

0 comments on commit dd3d829

Please sign in to comment.