Skip to content

Commit

Permalink
Prevent quoting numeric keys
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyWebb committed Jan 20, 2017
1 parent eee722a commit 019e720
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/rison.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ rison.quote = function(x) {
if (typeof x.__prototype__ === 'object' && typeof x.__prototype__.encode_rison !== 'undefined')
return x.encode_rison();

var a = ['('], b, f, i, v, ki, ks=[];
var a = ['('], b, i, v, k, ki, ks=[];
for (i in x)
ks[ks.length] = i;
ks.sort();
Expand All @@ -184,7 +184,8 @@ rison.quote = function(x) {
if (b) {
a[a.length] = ',';
}
a.push(s.string(i), ':', v);
k = isNaN(parseInt(i)) ? s.string(i) : s.number(i)
a.push(k, ':', v);
b = true;
}
}
Expand Down

0 comments on commit 019e720

Please sign in to comment.