Skip to content

Commit 8a58ae0

Browse files
committed
Fixes issue locutusjs#151
We had here _getType and type variables leaking to global scope, thus recursive calls to serialize were overwriting the type variable.
1 parent 52be837 commit 8a58ae0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

functions/var/serialize.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ function serialize(mixed_value) {
3939
}
4040
}
4141
return size;
42-
};
42+
},
4343
_getType = function (inp) {
4444
var match, key, cons, types, type = typeof inp;
4545

4646
if (type === 'object' && !inp) {
4747
return 'null';
4848
}
49+
4950
if (type === 'object') {
5051
if (!inp.constructor) {
5152
return 'object';
@@ -64,7 +65,7 @@ function serialize(mixed_value) {
6465
}
6566
}
6667
return type;
67-
};
68+
},
6869
type = _getType(mixed_value);
6970

7071
switch (type) {
@@ -119,4 +120,4 @@ function serialize(mixed_value) {
119120
val += ';';
120121
}
121122
return val;
122-
}
123+
}

0 commit comments

Comments
 (0)