Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit dd3d829173d3b3ebbaae41672a7b3b440e4ff851 1 parent fbce637
@virtuo virtuo authored
Showing with 8 additions and 8 deletions.
  1. +8 −8 lib/socket.io/util/object.js
View
16 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;
-};
+};
Please sign in to comment.
Something went wrong with that request. Please try again.