summaryrefslogtreecommitdiffstats
path: root/lib/external
diff options
context:
space:
mode:
Diffstat (limited to 'lib/external')
-rw-r--r--lib/external/json2.js249
-rw-r--r--lib/external/json2.min.js18
2 files changed, 132 insertions, 135 deletions
diff --git a/lib/external/json2.js b/lib/external/json2.js
index 0ddf117..2e88bb4 100644
--- a/lib/external/json2.js
+++ b/lib/external/json2.js
@@ -1,166 +1,165 @@
/*
-http://www.JSON.org/json2.js
-2011-10-19
+ json2.js
+ 2012-10-08
-Public Domain.
+ Public Domain.
-NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+ NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-See http://www.JSON.org/js.html
+ See http://www.JSON.org/js.html
-This code should be minified before deployment.
-See http://javascript.crockford.com/jsmin.html
+ This code should be minified before deployment.
+ See http://javascript.crockford.com/jsmin.html
-USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
-NOT CONTROL.
+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
+ NOT CONTROL.
-This file creates a global JSON object containing two methods: stringify
-and parse.
+ This file creates a global JSON object containing two methods: stringify
+ and parse.
-JSON.stringify(value, replacer, space)
-value any JavaScript value, usually an object or array.
+ JSON.stringify(value, replacer, space)
+ value any JavaScript value, usually an object or array.
-replacer an optional parameter that determines how object
-values are stringified for objects. It can be a
-function or an array of strings.
+ replacer an optional parameter that determines how object
+ values are stringified for objects. It can be a
+ function or an array of strings.
-space an optional parameter that specifies the indentation
-of nested structures. If it is omitted, the text will
-be packed without extra whitespace. If it is a number,
-it will specify the number of spaces to indent at each
-level. If it is a string (such as '\t' or ' '),
-it contains the characters used to indent at each level.
+ space an optional parameter that specifies the indentation
+ of nested structures. If it is omitted, the text will
+ be packed without extra whitespace. If it is a number,
+ it will specify the number of spaces to indent at each
+ level. If it is a string (such as '\t' or ' '),
+ it contains the characters used to indent at each level.
-This method produces a JSON text from a JavaScript value.
+ This method produces a JSON text from a JavaScript value.
-When an object value is found, if the object contains a toJSON
-method, its toJSON method will be called and the result will be
-stringified. A toJSON method does not serialize: it returns the
-value represented by the name/value pair that should be serialized,
-or undefined if nothing should be serialized. The toJSON method
-will be passed the key associated with the value, and this will be
-bound to the value
+ When an object value is found, if the object contains a toJSON
+ method, its toJSON method will be called and the result will be
+ stringified. A toJSON method does not serialize: it returns the
+ value represented by the name/value pair that should be serialized,
+ or undefined if nothing should be serialized. The toJSON method
+ will be passed the key associated with the value, and this will be
+ bound to the value
-For example, this would serialize Dates as ISO strings.
+ For example, this would serialize Dates as ISO strings.
-Date.prototype.toJSON = function (key) {
-function f(n) {
-// Format integers to have at least two digits.
-return n < 10 ? '0' + n : n;
-}
+ Date.prototype.toJSON = function (key) {
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
-return this.getUTCFullYear() + '-' +
-f(this.getUTCMonth() + 1) + '-' +
-f(this.getUTCDate()) + 'T' +
-f(this.getUTCHours()) + ':' +
-f(this.getUTCMinutes()) + ':' +
-f(this.getUTCSeconds()) + 'Z';
-};
+ return this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z';
+ };
-You can provide an optional replacer method. It will be passed the
-key and value of each member, with this bound to the containing
-object. The value that is returned from your method will be
-serialized. If your method returns undefined, then the member will
-be excluded from the serialization.
+ You can provide an optional replacer method. It will be passed the
+ key and value of each member, with this bound to the containing
+ object. The value that is returned from your method will be
+ serialized. If your method returns undefined, then the member will
+ be excluded from the serialization.
-If the replacer parameter is an array of strings, then it will be
-used to select the members to be serialized. It filters the results
-such that only members with keys listed in the replacer array are
-stringified.
+ If the replacer parameter is an array of strings, then it will be
+ used to select the members to be serialized. It filters the results
+ such that only members with keys listed in the replacer array are
+ stringified.
-Values that do not have JSON representations, such as undefined or
-functions, will not be serialized. Such values in objects will be
-dropped; in arrays they will be replaced with null. You can use
-a replacer function to replace those with JSON values.
-JSON.stringify(undefined) returns undefined.
+ Values that do not have JSON representations, such as undefined or
+ functions, will not be serialized. Such values in objects will be
+ dropped; in arrays they will be replaced with null. You can use
+ a replacer function to replace those with JSON values.
+ JSON.stringify(undefined) returns undefined.
-The optional space parameter produces a stringification of the
-value that is filled with line breaks and indentation to make it
-easier to read.
+ The optional space parameter produces a stringification of the
+ value that is filled with line breaks and indentation to make it
+ easier to read.
-If the space parameter is a non-empty string, then that string will
-be used for indentation. If the space parameter is a number, then
-the indentation will be that many spaces.
+ If the space parameter is a non-empty string, then that string will
+ be used for indentation. If the space parameter is a number, then
+ the indentation will be that many spaces.
-Example:
+ Example:
-text = JSON.stringify(['e', {pluribus: 'unum'}]);
-// text is '["e",{"pluribus":"unum"}]'
+ text = JSON.stringify(['e', {pluribus: 'unum'}]);
+ // text is '["e",{"pluribus":"unum"}]'
-text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
-// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
+ text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
+ // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
-text = JSON.stringify([new Date()], function (key, value) {
-return this[key] instanceof Date ?
-'Date(' + this[key] + ')' : value;
-});
-// text is '["Date(---current time---)"]'
+ text = JSON.stringify([new Date()], function (key, value) {
+ return this[key] instanceof Date ?
+ 'Date(' + this[key] + ')' : value;
+ });
+ // text is '["Date(---current time---)"]'
-JSON.parse(text, reviver)
-This method parses a JSON text to produce an object or array.
-It can throw a SyntaxError exception.
+ JSON.parse(text, reviver)
+ This method parses a JSON text to produce an object or array.
+ It can throw a SyntaxError exception.
-The optional reviver parameter is a function that can filter and
-transform the results. It receives each of the keys and values,
-and its return value is used instead of the original value.
-If it returns what it received, then the structure is not modified.
-If it returns undefined then the member is deleted.
+ The optional reviver parameter is a function that can filter and
+ transform the results. It receives each of the keys and values,
+ and its return value is used instead of the original value.
+ If it returns what it received, then the structure is not modified.
+ If it returns undefined then the member is deleted.
-Example:
+ Example:
-// Parse the text. Values that look like ISO date strings will
-// be converted to Date objects.
+ // Parse the text. Values that look like ISO date strings will
+ // be converted to Date objects.
-myData = JSON.parse(text, function (key, value) {
-var a;
-if (typeof value === 'string') {
-a =
+ myData = JSON.parse(text, function (key, value) {
+ var a;
+ if (typeof value === 'string') {
+ a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
-if (a) {
-return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
-+a[5], +a[6]));
-}
-}
-return value;
-});
-
-myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
-var d;
-if (typeof value === 'string' &&
-value.slice(0, 5) === 'Date(' &&
-value.slice(-1) === ')') {
-d = new Date(value.slice(5, -1));
-if (d) {
-return d;
-}
-}
-return value;
-});
+ if (a) {
+ return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+ +a[5], +a[6]));
+ }
+ }
+ return value;
+ });
+
+ myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
+ var d;
+ if (typeof value === 'string' &&
+ value.slice(0, 5) === 'Date(' &&
+ value.slice(-1) === ')') {
+ d = new Date(value.slice(5, -1));
+ if (d) {
+ return d;
+ }
+ }
+ return value;
+ });
-This is a reference implementation. You are free to copy, modify, or
-redistribute.
+ This is a reference implementation. You are free to copy, modify, or
+ redistribute.
*/
/*jslint evil: true, regexp: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
-call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
-getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
-lastIndex, length, parse, prototype, push, replace, slice, stringify,
-test, toJSON, toString, valueOf
+ call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
+ getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
+ lastIndex, length, parse, prototype, push, replace, slice, stringify,
+ test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
-var JSON;
-if (!JSON) {
+if (typeof JSON !== 'object') {
JSON = {};
}
@@ -306,10 +305,10 @@ if (!JSON) {
// brackets.
v = partial.length === 0
- ? '[]'
- : gap
- ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
- : '[' + partial.join(',') + ']';
+ ? '[]'
+ : gap
+ ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
+ : '[' + partial.join(',') + ']';
gap = mind;
return v;
}
@@ -345,10 +344,10 @@ if (!JSON) {
// and wrap them in braces.
v = partial.length === 0
- ? '{}'
- : gap
- ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
- : '{' + partial.join(',') + '}';
+ ? '{}'
+ : gap
+ ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
+ : '{' + partial.join(',') + '}';
gap = mind;
return v;
}
@@ -484,4 +483,4 @@ if (!JSON) {
throw new SyntaxError('JSON.parse');
};
}
-} ()); \ No newline at end of file
+}()); \ No newline at end of file
diff --git a/lib/external/json2.min.js b/lib/external/json2.min.js
index 2072357..2897582 100644
--- a/lib/external/json2.min.js
+++ b/lib/external/json2.min.js
@@ -1,10 +1,8 @@
-/*
-http://www.JSON.org/json2.js
-*/
-var JSON;JSON||(JSON={});
-(function(){function k(a){return 10>a?"0"+a:a}function o(a){p.lastIndex=0;return p.test(a)?'"'+a.replace(p,function(a){var c=r[a];return"string"===typeof c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function m(a,j){var c,d,h,n,g=e,f,b=j[a];b&&"object"===typeof b&&"function"===typeof b.toJSON&&(b=b.toJSON(a));"function"===typeof i&&(b=i.call(j,a,b));switch(typeof b){case "string":return o(b);case "number":return isFinite(b)?""+b:"null";case "boolean":case "null":return""+b;
-case "object":if(!b)return"null";e+=l;f=[];if("[object Array]"===Object.prototype.toString.apply(b)){n=b.length;for(c=0;c<n;c+=1)f[c]=m(c,b)||"null";h=0===f.length?"[]":e?"[\n"+e+f.join(",\n"+e)+"\n"+g+"]":"["+f.join(",")+"]";e=g;return h}if(i&&"object"===typeof i){n=i.length;for(c=0;c<n;c+=1)"string"===typeof i[c]&&(d=i[c],(h=m(d,b))&&f.push(o(d)+(e?": ":":")+h))}else for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(h=m(d,b))&&f.push(o(d)+(e?": ":":")+h);h=0===f.length?"{}":e?"{\n"+e+f.join(",\n"+
-e)+"\n"+g+"}":"{"+f.join(",")+"}";e=g;return h}}if("function"!==typeof Date.prototype.toJSON)Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()};var q=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
-p=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e,l,r={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},i;if("function"!==typeof JSON.stringify)JSON.stringify=function(a,j,c){var d;l=e="";if("number"===typeof c)for(d=0;d<c;d+=1)l+=" ";else"string"===typeof c&&(l=c);if((i=j)&&"function"!==typeof j&&("object"!==typeof j||"number"!==typeof j.length))throw Error("JSON.stringify");return m("",
-{"":a})};if("function"!==typeof JSON.parse)JSON.parse=function(a,e){function c(a,d){var g,f,b=a[d];if(b&&"object"===typeof b)for(g in b)Object.prototype.hasOwnProperty.call(b,g)&&(f=c(b,g),void 0!==f?b[g]=f:delete b[g]);return e.call(a,d,b)}var d,a=""+a;q.lastIndex=0;q.test(a)&&(a=a.replace(q,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
-"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return d=eval("("+a+")"),"function"===typeof e?c({"":d},""):d;throw new SyntaxError("JSON.parse");}})(); \ No newline at end of file
+/* http://www.JSON.org */
+"object"!==typeof JSON&&(JSON={});
+(function(){function l(a){return 10>a?"0"+a:a}function q(a){r.lastIndex=0;return r.test(a)?'"'+a.replace(r,function(a){var c=t[a];return"string"===typeof c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function n(a,k){var c,d,h,p,g=e,f,b=k[a];b&&("object"===typeof b&&"function"===typeof b.toJSON)&&(b=b.toJSON(a));"function"===typeof j&&(b=j.call(k,a,b));switch(typeof b){case "string":return q(b);case "number":return isFinite(b)?String(b):"null";case "boolean":case "null":return String(b);
+case "object":if(!b)return"null";e+=m;f=[];if("[object Array]"===Object.prototype.toString.apply(b)){p=b.length;for(c=0;c<p;c+=1)f[c]=n(c,b)||"null";h=0===f.length?"[]":e?"[\n"+e+f.join(",\n"+e)+"\n"+g+"]":"["+f.join(",")+"]";e=g;return h}if(j&&"object"===typeof j){p=j.length;for(c=0;c<p;c+=1)"string"===typeof j[c]&&(d=j[c],(h=n(d,b))&&f.push(q(d)+(e?": ":":")+h))}else for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(h=n(d,b))&&f.push(q(d)+(e?": ":":")+h);h=0===f.length?"{}":e?"{\n"+e+f.join(",\n"+
+e)+"\n"+g+"}":"{"+f.join(",")+"}";e=g;return h}}"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+l(this.getUTCMonth()+1)+"-"+l(this.getUTCDate())+"T"+l(this.getUTCHours())+":"+l(this.getUTCMinutes())+":"+l(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var s=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e,m,t={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,k,c){var d;m=e="";if("number"===typeof c)for(d=0;d<c;d+=1)m+=" ";else"string"===typeof c&&(m=c);if((j=k)&&"function"!==typeof k&&("object"!==typeof k||"number"!==typeof k.length))throw Error("JSON.stringify");return n("",{"":a})});
+"function"!==typeof JSON.parse&&(JSON.parse=function(a,e){function c(a,d){var g,f,b=a[d];if(b&&"object"===typeof b)for(g in b)Object.prototype.hasOwnProperty.call(b,g)&&(f=c(b,g),void 0!==f?b[g]=f:delete b[g]);return e.call(a,d,b)}var d;a=String(a);s.lastIndex=0;s.test(a)&&(a=a.replace(s,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return d=eval("("+a+")"),"function"===typeof e?c({"":d},""):d;throw new SyntaxError("JSON.parse");})})(); \ No newline at end of file