Skip to content

Commit

Permalink
Update to newest JSON-js
Browse files Browse the repository at this point in the history
  • Loading branch information
shadlaws committed Aug 28, 2013
1 parent 68e709c commit 78049ab
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 29 deletions.
12 changes: 6 additions & 6 deletions JSON-js/modified/json2-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 24 additions & 18 deletions JSON-js/upstream/json.js
@@ -1,6 +1,6 @@
/*
json.js
2012-10-08
2013-05-26
Public Domain
Expand Down Expand Up @@ -212,13 +212,14 @@ if (typeof JSON !== 'object') {

Date.prototype.toJSON = function (key) {

return isFinite(this.valueOf()) ?
this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z' : null;
return isFinite(this.valueOf())
? this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z'
: null;
};

String.prototype.toJSON =
Expand Down Expand Up @@ -254,8 +255,9 @@ if (typeof JSON !== 'object') {
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string' ? c :
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
return typeof c === 'string'
? c
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}

Expand Down Expand Up @@ -339,9 +341,11 @@ if (typeof JSON !== 'object') {
// Join all of the elements together, separated with commas, and wrap them in
// brackets.

v = partial.length === 0 ? '[]' : gap ?
'[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
'[' + partial.join(',') + ']';
v = partial.length === 0
? '[]'
: gap
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
: '[' + partial.join(',') + ']';
gap = mind;
return v;
}
Expand Down Expand Up @@ -376,9 +380,10 @@ if (typeof JSON !== 'object') {
// Join all of the member texts together, separated with commas,
// and wrap them in braces.

v = partial.length === 0 ? '{}' : gap ?
'{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
'{' + partial.join(',') + '}';
v = partial.length === 0 ? '{}'
: gap
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
: '{' + partial.join(',') + '}';
gap = mind;
return v;
}
Expand Down Expand Up @@ -504,8 +509,9 @@ if (typeof JSON !== 'object') {
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.

return typeof reviver === 'function' ?
walk({'': j}, '') : j;
return typeof reviver === 'function'
? walk({'': j}, '')
: j;
}

// If the text is not JSON parseable, then a SyntaxError is thrown.
Expand Down
6 changes: 3 additions & 3 deletions JSON-js/upstream/json2.js
@@ -1,6 +1,6 @@
/*
json2.js
2012-10-08
2013-05-26
Public Domain.
Expand Down Expand Up @@ -173,7 +173,7 @@ if (typeof JSON !== 'object') {

if (typeof Date.prototype.toJSON !== 'function') {

Date.prototype.toJSON = function (key) {
Date.prototype.toJSON = function () {

return isFinite(this.valueOf())
? this.getUTCFullYear() + '-' +
Expand All @@ -187,7 +187,7 @@ if (typeof JSON !== 'object') {

String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
Boolean.prototype.toJSON = function () {
return this.valueOf();
};
}
Expand Down
4 changes: 2 additions & 2 deletions JSON-js/upstream/json_parse_state.js
@@ -1,6 +1,6 @@
/*
json_parse_state.js
2012-06-01
2013-05-26
Public Domain.
Expand Down Expand Up @@ -46,7 +46,7 @@
NOT CONTROL.
*/

/*jslint regexp: false*/
/*jslint regexp: true, unparam: true */

/*members "", "\"", ",", "\/", ":", "[", "\\", "]", acomma, avalue, b,
call, colon, container, exec, f, false, firstavalue, firstokey,
Expand Down

0 comments on commit 78049ab

Please sign in to comment.