Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

JSON v3.2.1.

  • Loading branch information...
commit 5ad5b674522468ff84a36d5098460574882e24a4 1 parent c4ce5f1
Kit Cambridge kitcambridge authored
4 README.md
Source Rendered
@@ -2,10 +2,10 @@
2 2
3 3 ![JSON 3 Logo](http://bestiejs.github.com/json3/page/logo.png)
4 4
5   -**JSON 3** is a modern JSON implementation compatible with a variety of JavaScript platforms, including Internet Explorer 6, Opera 7, Safari 2, and Netscape 6. The current version is **3.2**.
  5 +**JSON 3** is a modern JSON implementation compatible with a variety of JavaScript platforms, including Internet Explorer 6, Opera 7, Safari 2, and Netscape 6. The current version is **3.2.1**.
6 6
7 7 - [Development Version](http://bestiejs.github.com/json3/lib/json3.js) *(37 KB; uncompressed with comments)*
8   -- [Production Version](http://bestiejs.github.com/json3/lib/json3.min.js) *(3.4 KB; compressed)*
  8 +- [Production Version](http://bestiejs.github.com/json3/lib/json3.min.js) *(3.1 KB; compressed)*
9 9
10 10 [JSON](http://json.org/) is a language-independent data interchange format based on a loose subset of the JavaScript grammar. Originally popularized by [Douglas Crockford](http://www.crockford.com/), the format was standardized in the [fifth edition](http://es5.github.com/) of the ECMAScript specification. The 5.1 edition, ratified in June 2011, incorporates several modifications to the grammar pertaining to the serialization of dates.
11 11
6 index.html
@@ -19,12 +19,12 @@
19 19 <p><img src="http://bestiejs.github.com/json3/page/logo.png" alt="JSON 3 Logo">
20 20
21 21 </p>
22   -<p><strong>JSON 3</strong> is a modern JSON implementation compatible with a variety of JavaScript platforms, including Internet Explorer 6, Opera 7, Safari 2, and Netscape 6. The current version is <strong>3.2</strong>.
  22 +<p><strong>JSON 3</strong> is a modern JSON implementation compatible with a variety of JavaScript platforms, including Internet Explorer 6, Opera 7, Safari 2, and Netscape 6. The current version is <strong>3.2.1</strong>.
23 23
24 24 </p>
25 25 <ul>
26 26 <li><a href="http://bestiejs.github.com/json3/lib/json3.js">Development Version</a> <em>(37 KB; uncompressed with comments)</em></li>
27   -<li><a href="http://bestiejs.github.com/json3/lib/json3.min.js">Production Version</a> <em>(3.4 KB; compressed)</em></li>
  27 +<li><a href="http://bestiejs.github.com/json3/lib/json3.min.js">Production Version</a> <em>(3.1 KB; compressed)</em></li>
28 28 </ul>
29 29 <p><a href="http://json.org/">JSON</a> is a language-independent data interchange format based on a loose subset of the JavaScript grammar. Originally popularized by <a href="http://www.crockford.com/">Douglas Crockford</a>, the format was standardized in the <a href="http://es5.github.com/">fifth edition</a> of the ECMAScript specification. The 5.1 edition, ratified in June 2011, incorporates several modifications to the grammar pertaining to the serialization of dates.
30 30
@@ -32,7 +32,7 @@
32 32 <p>JSON 3 exposes two functions: <code>stringify()</code> for <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/stringify">serializing</a> a JavaScript value to JSON, and <code>parse()</code> for <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/parse">producing</a> a JavaScript value from a JSON source string. It is a <strong>drop-in replacement</strong> for <a href="http://json.org/js">JSON 2</a>. The functions behave exactly as described in the ECMAScript spec, <strong>except</strong> for the date serialization discrepancy noted below.
33 33
34 34 </p>
35   -<p>The JSON 3 parser does <strong>not</strong> use <code>eval</code> or regular expressions. This provides security and performance benefits in obsolete and mobile environments, where the margin is particularly significant. Informal benchmarks have shown that JSON 3 is slower than Crockford&#39;s <a href="https://github.com/douglascrockford/JSON-js">recursive descent parser</a> and Mike Samuel&#39;s <a href="http://code.google.com/p/json-sans-eval/"><code>json-sans-eval</code></a>, but approximates the speed of the <code>eval</code>-based JSON 2 parser.
  35 +<p>The JSON 3 parser does <strong>not</strong> use <code>eval</code> or regular expressions. This provides security and performance benefits in obsolete and mobile environments, where the margin is particularly significant. <a href="http://jsperf.com/crockfords-json-libraries/2">Benchmarks</a> have shown that JSON 3 is slower than the <code>eval</code>-based JSON 2 parser, but approximates the speed of Crockford&#39;s <a href="https://github.com/douglascrockford/JSON-js">recursive descent parser</a>, Mike Samuel&#39;s <a href="http://code.google.com/p/json-sans-eval/"><code>json-sans-eval</code></a>, and Asen Bozhilov&#39;s <a href="https://github.com/abozhilov/json"><code>json.js</code></a>.
36 36
37 37 </p>
38 38 <p>The project is <a href="http://git.io/json3">hosted on GitHub</a>, along with the <a href="http://bestiejs.github.com/json3/test/test_browser.html">unit tests</a>. It is part of the <a href="https://github.com/bestiejs">BestieJS</a> family, a collection of best-in-class JavaScript libraries that promote cross-platform support, specification precedents, unit testing, and plenty of documentation.
1  jsl.conf
@@ -13,6 +13,7 @@
13 13 +define console
14 14 +define print
15 15 +define module
  16 ++define JSON
16 17
17 18 # Function does not explicitly return a value.
18 19 -no_return_value
2  lib/json3.js
... ... @@ -1,4 +1,4 @@
1   -/*! JSON v3.2 | http://bestiejs.github.com/json3 | Copyright 2012, Kit Cambridge | http://kit.mit-license.org */
  1 +/*! JSON v3.2.1 | http://bestiejs.github.com/json3 | Copyright 2012, Kit Cambridge | http://kit.mit-license.org */
2 2 ;(function () {
3 3 // Convenience aliases.
4 4 var getClass = {}.toString, isProperty, forEach, undef,
23 lib/json3.min.js
... ... @@ -1,4 +1,19 @@
1   -/* JSON v3.2 | http://bestiejs.github.com/json3 | Copyright 2012, Kit Cambridge | http://kit.mit-license.org */
2   -;(function(a,b){typeof define=="function"&&define.amd?define("json",["exports"],b):b(typeof exports=="object"&&exports||this.JSON||(this.JSON={}))})(this,function(a){var b={}.toString,c={}.hasOwnProperty,d=!1,e,f,g;e=typeof a.stringify=="function",f=typeof a.parse=="function",function(){var c='{"result":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}',g=new Date(-0xc782b5b800cec),h,i;d=typeof g.getUTCFullYear=="function"&&g.getUTCFullYear()==-109252&&typeof g.getUTCMonth=="function"&&g.getUTCMonth()===0&&typeof g.getUTCDate=="function"&&g.getUTCDate()==1,g=null;if(e){h=function(){return 1},h.toJSON=h;try{switch(!1){case a.stringify(0)==="0":case a.stringify(new 0..constructor)==="0":case a.stringify(new"".constructor)=='""':case a.stringify(b)===void 0:case a.stringify(void 0)===void 0:case a.stringify()===void 0:case a.stringify(h)==="1":case a.stringify([h])=="[1]":case a.stringify([void 0])=="[null]":case a.stringify(null)=="null":case a.stringify([void 0,b,null])=="[null,null,null]":case a.stringify({result:[h,true,false,null,"\0\b\n\f\r "]})==c:case a.stringify(null,h)==="1":case a.stringify([1,2],null,1)=="[\n 1,\n 2\n]":case(h=new Date(-864e13)).getUTCFullYear()!=-271821||a.stringify(h)=='"-271821-04-20T00:00:00.000Z"':case(h=new Date(864e13)).getUTCFullYear()!=275760||a.stringify(h)=='"+275760-09-13T00:00:00.000Z"':case a.stringify(new Date(-621987552e5))=='"-000001-01-01T00:00:00.000Z"':case a.stringify(new Date(-1))=='"1969-12-31T23:59:59.999Z"':e=!1}}catch(j){e=!1}}if(f)try{if(a.parse("0")===0&&!a.parse(!1)){g=a.parse(c);if(f=g.result.length==5&&g.result[0]==1){try{f=!a.parse('" "')}catch(j){}if(f)try{f=a.parse("+1")!=1&&a.parse("01")!=1}catch(j){}}}}catch(j){f=!1}}();if(!c||b.call(c)!="[object Function]")c=function(){var a,c={},d=c.constructor;return(c.__proto__=null,c.__proto__={toString:1},c).toString!=b?a=function(b){var c=this.__proto__,d=b in(this.__proto__=null,this);return this.__proto__=c,d}:a=function(b){var c=(this.constructor||d).prototype;return b in this&&!(b in c&&this[b]===c[b])},c=null,a}();g=function(){function g(){this.valueOf=0}var a,d,e,f=0;g.prototype.valueOf=0,a=new g;for(d in a)c.call(a,d)&&(f+=1);return a=null,f?f==2?e=function(d,e){var f={},g=b.call(d)=="[object Function]",h;for(h in d)(!g||h!="prototype")&&!c.call(f,h)&&(f[h]=1)&&c.call(d,h)&&e(h)}:e=function(d,e){var f=b.call(d)=="[object Function]",g,h;for(g in d)(!f||g!="prototype")&&c.call(d,g)&&!(h=g==="constructor")&&e(g);(h||c.call(d,"constructor"))&&e("constructor")}:(a=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],e=function(e,f){var g=b.call(e)=="[object Function]",h,i;for(h in e)(!g||h!="prototype")&&c.call(e,h)&&f(h);for(i=a.length;h=a[--i];c.call(e,h)&&f(h));}),e}();if(!e||e&&!d)a.stringify=function(){function h(a,b){return("000000"+(b||0)).slice(-a)}function i(b){var c='"',d=0,e;for(;e=b.charAt(d);d+=1)c+='\\"\b\f\n\r '.indexOf(e)>-1?a[e]:e<" "?"\\u00"+h(2,e.charCodeAt(0).toString(16)):e;return c+'"'}function j(a,b){return e[b]+365*(a-1970)+f((a-1969+(b=+(b>1)))/4)-f((a-1901+b)/100)+f((a-1601+b)/400)}function k(a,e,l,m,n,o,p){var q=e[a],r,s,t,u,v,w,x,y,z,A;if(typeof q=="object"&&q)if(b.call(q)=="[object Date]"&&!c.call(q,"toJSON"))if(q>-1/0&&q<1/0){if(d)t=q.getUTCFullYear(),u=q.getUTCMonth(),s=q.getUTCDate();else{s=f(q/864e5);for(t=f(s/365.2425)+1970-1;j(t+1,0)<=s;t+=1);for(u=f((s-j(t,0))/30.42);j(t,u+1)<=s;u+=1);s=1+s-j(t,u)}q=(t<=0||t>=1e4?(t<0?"-":"+")+h(6,t<0?-t:t):h(4,t))+"-"+h(2,u+1)+"-"+h(2,s)+"T"+h(2,q.getUTCHours())+":"+h(2,q.getUTCMinutes())+":"+h(2,q.getUTCSeconds())+"."+h(3,q.getUTCMilliseconds())+"Z"}else q=null;else typeof q.toJSON=="function"&&(q=q.toJSON(a));l&&(q=l.call(e,a,q));if(q===null)return"null";r=b.call(q);switch(r){case"[object Boolean]":return""+q;case"[object Number]":return q>-1/0&&q<1/0?""+q:"null";case"[object String]":return i(q)}if(typeof q=="object"){for(y=p.length;y--;)if(p[y]==q)throw TypeError("Cyclic structures cannot be serialized."
3   -);p.push(q),v=[],z=o,o+=n;if(r=="[object Array]"){for(x=0,y=q.length;x<y;A||(A=!0),x++)w=k(x,q,l,m,n,o,p),v.push(w===void 0?"null":w);return A?n?"[\n"+o+v.join(",\n"+o)+"\n"+z+"]":"["+v.join(",")+"]":"[]"}return g(m||q,function(a){var b=k(a,q,l,m,n,o,p);b!==void 0&&v.push(i(a)+":"+(n?" ":"")+b),A||(A=!0)}),A?n?"{\n"+o+v.join(",\n"+o)+"\n"+z+"}":"{"+v.join(",")+"}":"{}"}}function l(a,c,d){var e,f,g,h,i;if(typeof c=="function"||typeof c=="object"&&c)if(b.call(c)=="[object Function]")f=c;else if(b.call(c)=="[object Array]"){g={};for(h=c.length;h--;(i=c[h])&&(b.call(i)=="[object String]"||b.call(i)=="[object Number]")&&(g[i]=1));}if(d!=null&&d!==""&&d!==0)if(b.call(d)=="[object Number]"){if((d-=d%1)>0)for(e="",d>10&&(d=10);e.length<d;e+=" ");}else b.call(d)=="[object String]"&&(e=d.length<=10?d:d.slice(0,10));return k("",(i={},i[""]=a,i),f,g,e,"",[])}var a={"\\":"\\\\",'"':'\\"',"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},e=[0,31,59,90,120,151,181,212,243,273,304,334],f=Math.floor;return l}();return f||(a.parse=function(){function d(a){this.source=a,this.index=0}function e(){for(var b=this.source,d=this.source.length,e,f,g,h,i;this.index<d;){e=b.charAt(this.index);switch(e){case" ":case"\r":case"\n":case" ":this.index+=1;break;case"{":case"}":case"[":case"]":case":":case",":return this.index+=1,e;case'"':for(f="@",this.index+=1;this.index<d;){e=b.charAt(this.index);if(e<" ")throw SyntaxError("Unescaped control character in string.");if(e=="\\"){this.index+=1,e=b.charAt(this.index);if('\\"/btnfr'.indexOf(e)>-1)f+=a[e],this.index+=1;else{if(e!="u")throw SyntaxError("Invalid escape sequence in string.");g=this.index+=1;for(h=this.index+4;this.index<h;this.index+=1){e=b.charAt(this.index);if(!(e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"))throw SyntaxError("Invalid Unicode escape sequence in string.")}f+=c("0x"+b.slice(g,this.index))}}else{if(e=='"')break;f+=e,this.index+=1}}if(b.charAt(this.index)=='"')return this.index+=1,f;throw SyntaxError("Unterminated string.");default:g=this.index,e=="-"&&(i=!0,e=b.charAt(this.index+=1));if(e>="0"&&e<="9"){if(e=="0"&&(e=b.charAt(this.index+1),e>="0"&&e<="9"))throw SyntaxError("Illegal octal literal.");i=!1;for(;this.index<d&&(e=b.charAt(this.index),e>="0"&&e<="9");this.index+=1);if(b.charAt(this.index)=="."){h=this.index+=1;for(;h<d&&(e=b.charAt(h),e>="0"&&e<="9");h+=1);if(h==this.index)throw SyntaxError("Illegal trailing decimal.");this.index=h}e=b.charAt(this.index);if(e=="e"||e=="E"){e=b.charAt(this.index+=1);if(e=="+"||e=="-")this.index+=1;for(h=this.index;h<d&&(e=b.charAt(h),e>="0"&&e<="9");h+=1);if(h==this.index)throw SyntaxError("Illegal empty exponent.");this.index=h}return+b.slice(g,this.index)}if(i)throw SyntaxError("Unexpected `-`.");if(e=="t"&&b.slice(this.index,this.index+4)=="true")return this.index+=4,!0;if(e=="f"&&b.slice(this.index,this.index+5)=="false")return this.index+=5,!1;if(e=="n"&&b.slice(this.index,this.index+4)=="null")return this.index+=4,null;throw SyntaxError("Unrecognized token.")}}return"$"}function f(a){var b,c,d;if(a=="$")throw SyntaxError("Unexpected end-of-file.");if(typeof a=="string"){if(a.charAt(0)=="@")return a.slice(1);switch(a){case"[":b=[];for(;;c||(c=!0)){a=this.lex();if(a=="]")break;if(c){if(a!=",")throw SyntaxError("A comma (`,`) must separate the previous array element from the next.");a=this.lex();if(a=="]")throw SyntaxError("Unexpected trailing `,` in array literal.")}if(a==",")throw SyntaxError("Unexpected `,` in array literal.");b.push(this.get(a))}return b;case"{":b={};for(;;c||(c=!0)){a=this.lex();if(a=="}")break;if(c){if(a!=",")throw SyntaxError("A comma (`,`) must separate the previous object member from the next.");a=this.lex();if(a=="}")throw SyntaxError("Unexpected trailing `,`. in object literal.")}if(a==",")throw SyntaxError("Unexpected `,` in object literal.");if(typeof a!="string"||a.charAt(0)!="@")throw SyntaxError("Object property names must be double-quoted strings.");if(this.lex()!=":")throw SyntaxError("A single colon (`:`) must separate each object property name from the value.");b[a.slice(1)]=this.get(this.lex
4   -())}return b}throw SyntaxError("Expected `[` or `{`.")}return a}function h(a,c,d){var e=a[c],f,i;if(typeof e=="object"&&e)if(b.call(e)=="[object Array]")for(f=e.length;f--;)i=h(e,f,d),i===void 0?e.splice(f,1):e[f]=i;else g(e,function(a){var b=h(e,a,d);b===void 0?delete e[a]:e[a]=b});return d.call(a,c,e)}function i(a,c){var e=new d(""+a),f=e.get(e.lex()),g;if(e.lex()!="$")throw SyntaxError("Expected end-of-file.");return c&&b.call(c)=="[object Function]"?h((g={},g[""]=f,g),"",c):f}var a={"\\":"\\",'"':'"',"/":"/",b:"\b",t:" ",n:"\n",f:"\f",r:"\r"},c="".constructor.fromCharCode;return d.prototype.lex=e,d.prototype.get=f,i}()),a})
  1 +/*! JSON v3.2.1 | http://bestiejs.github.com/json3 | Copyright 2012, Kit Cambridge | http://kit.mit-license.org */
  2 +;(function(){function j(l){throw l;}var m=void 0,p=!0,w=null,x=!1;
  3 +(function(){var l={}.toString,n,C,o="function"===typeof define&&define.c,c="object"==typeof exports&&exports,D='{"result":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}',F,q,E,B,i="function"==typeof c.parse,G,H,u,v,f=new Date(-3509827334573292),r,I,y;try{f=-109252==f.getUTCFullYear()&&0===f.getUTCMonth()&&1==f.getUTCDate()&&10==f.getUTCHours()&&37==f.getUTCMinutes()&&6==f.getUTCSeconds()&&708==f.getUTCMilliseconds()}catch(J){}f||(r=Math.floor,I=[0,31,59,90,120,151,181,212,243,273,304,334],y=function(b,
  4 +e){return I[e]+365*(b-1970)+r((b-1969+(e=+(1<e)))/4)-r((b-1901+e)/100)+r((b-1601+e)/400)});o||c?(o&&define("json",c={}),"object"==typeof JSON&&JSON&&(c.stringify=JSON.stringify,c.parse=JSON.parse)):c=this.JSON||(this.JSON={});if(o="function"==typeof c.stringify&&!y){f=function(){return 1};f.toJSON=f;try{switch(x){case "0"===c.stringify(0):case "0"===c.stringify(new (0).constructor):case '""'==c.stringify(new "".constructor):case c.stringify(l)===m:case c.stringify(m)===m:case c.stringify()===m:case "1"===
  5 +c.stringify(f):case "[1]"==c.stringify([f]):case "[null]"==c.stringify([m]):case "null"==c.stringify(w):case "[null,null,null]"==c.stringify([m,l,w]):case c.stringify({result:[f,p,x,w,"\x00\u0008\n\u000c\r\t"]})==D:case "1"===c.stringify(w,f):case "[\n 1,\n 2\n]"==c.stringify([1,2],w,1):case '"-271821-04-20T00:00:00.000Z"'==c.stringify(new Date(-864E13)):case '"+275760-09-13T00:00:00.000Z"'==c.stringify(new Date(864E13)):case '"-000001-01-01T00:00:00.000Z"'==c.stringify(new Date(-621987552E5)):case '"1969-12-31T23:59:59.999Z"'==
  6 +c.stringify(new Date(-1)):o=x}}catch(K){o=x}}if(i)try{if(0===c.parse("0")&&!c.parse(x)&&(f=c.parse(D),i=5==f.result.length&&1==f.result[0])){try{i=!c.parse('"\t"')}catch(L){}if(i)try{i=1!=c.parse("+1")&&1!=c.parse("01")}catch(M){}}}catch(N){i=x}f=D=w;if(!o||!i){if(!(n={}.hasOwnProperty))n=function(b){var e={},a;if((e.__proto__=w,e.__proto__={toString:1},e).toString!=l)n=function(a){var b=this.__proto__,a=a in(this.__proto__=w,this);this.__proto__=b;return a};else{a=e.constructor;n=function(b){var e=
  7 +(this.constructor||a).prototype;return b in this&&!(b in e&&this[b]===e[b])}}e=w;return n.call(this,b)};C=function(b,e){var a=0,d,c,h;(d=function(){this.valueOf=0}).prototype.valueOf=0;c=new d;for(h in c)n.call(c,h)&&a++;d=c=w;if(a)a=a==2?function(a,b){var e={},d=l.call(a)=="[object Function]",c;for(c in a)!(d&&c=="prototype")&&!n.call(e,c)&&(e[c]=1)&&n.call(a,c)&&b(c)}:function(a,b){var e=l.call(a)=="[object Function]",c,d;for(c in a)!(e&&c=="prototype")&&n.call(a,c)&&!(d=c==="constructor")&&b(c);
  8 +(d||n.call(a,c="constructor"))&&b(c)};else{c=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];a=function(a,b){var e=l.call(a)=="[object Function]",d;for(d in a)!(e&&d=="prototype")&&n.call(a,d)&&b(d);for(e=c.length;d=c[--e];n.call(a,d)&&b(d));}}a(b,e)};o||(F={"\\":"\\\\",'"':'\\"',"\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},q=function(b,e){return("000000"+(e||0)).slice(-b)},E=function(b){for(var e='"',a=0,d;d=b.charAt(a);a++)e=
  9 +e+('\\"\u0008\u000c\n\r\t'.indexOf(d)>-1?F[d]:d<" "?"\\u00"+q(2,d.charCodeAt(0).toString(16)):d);return e+'"'},B=function(b,e,a,d,c,h,f){var g=e[b],k,s,t,i,o,u,v,z,A;if(typeof g=="object"&&g)if(l.call(g)=="[object Date]"&&!n.call(g,"toJSON"))if(g>-1/0&&g<1/0){if(y){t=r(g/864E5);for(k=r(t/365.2425)+1970-1;y(k+1,0)<=t;k++);for(s=r((t-y(k,0))/30.42);y(k,s+1)<=t;s++);t=1+t-y(k,s);i=(g%864E5+864E5)%864E5;o=r(i/36E5)%24;u=r(i/6E4)%60;v=r(i/1E3)%60;i=i%1E3}else{k=g.getUTCFullYear();s=g.getUTCMonth();t=g.getUTCDate();
  10 +o=g.getUTCHours();u=g.getUTCMinutes();v=g.getUTCSeconds();i=g.getUTCMilliseconds()}g=(k<=0||k>=1E4?(k<0?"-":"+")+q(6,k<0?-k:k):q(4,k))+"-"+q(2,s+1)+"-"+q(2,t)+"T"+q(2,o)+":"+q(2,u)+":"+q(2,v)+"."+q(3,i)+"Z"}else g=w;else typeof g.toJSON=="function"&&(g=g.toJSON(b));a&&(g=a.call(e,b,g));if(g===w)return"null";k=l.call(g);switch(k){case "[object Boolean]":return""+g;case "[object Number]":return g>-1/0&&g<1/0?""+g:"null";case "[object String]":return E(g)}if(typeof g=="object"){for(b=f.length;b--;)f[b]===
  11 +g&&j(TypeError());f.push(g);z=[];e=h;h=h+c;if(k=="[object Array]"){s=0;for(b=g.length;s<b;A||(A=p),s++){k=B(s,g,a,d,c,h,f);z.push(k===m?"null":k)}return A?c?"[\n"+h+z.join(",\n"+h)+"\n"+e+"]":"["+z.join(",")+"]":"[]"}C(d||g,function(b){var e=B(b,g,a,d,c,h,f);e!==m&&z.push(E(b)+":"+(c?" ":"")+e);A||(A=p)});return A?c?"{\n"+h+z.join(",\n"+h)+"\n"+e+"}":"{"+z.join(",")+"}":"{}"}},c.stringify=function(b,e,a){var c,f,h,i,g;if(typeof e=="function"||typeof e=="object"&&e)if(l.call(e)=="[object Function]")f=
  12 +e;else if(l.call(e)=="[object Array]"){h={};for(i=e.length;i--;(g=e[i])&&(l.call(g)=="[object String]"||l.call(g)=="[object Number]")&&(h[g]=1));}if(a)if(l.call(a)=="[object Number]"){if((a=a-a%1)>0){c="";for(a>10&&(a=10);c.length<a;c=c+" ");}}else l.call(a)=="[object String]"&&(c=a.length<=10?a:a.slice(0,10));return B("",(g={},g[""]=b,g),f,h,c,"",[])});i||(G="".constructor.fromCharCode,H={"\\":"\\",'"':'"',"/":"/",b:"\u0008",t:"\t",n:"\n",f:"\u000c",r:"\r"},u=function(b){this.source=b;this.index=
  13 +0},u.prototype.a=function(){for(var b=this.source,c=this.source.length,a,d,f,h,i;this.index<c;){a=b.charAt(this.index);switch(a){case "\t":case "\r":case "\n":case " ":this.index++;break;case "{":case "}":case "[":case "]":case ":":case ",":this.index++;return a;case '"':d="@";for(this.index++;this.index<c;){a=b.charAt(this.index);a<" "&&j(SyntaxError());if(a=="\\"){this.index++;a=b.charAt(this.index);if('\\"/btnfr'.indexOf(a)>-1){d=d+H[a];this.index++}else if(a=="u"){f=++this.index;for(h=this.index+
  14 +4;this.index<h;this.index++){a=b.charAt(this.index);a>="0"&&a<="9"||a>="a"&&a<="f"||a>="A"&&a<="F"||j(SyntaxError())}d=d+G("0x"+b.slice(f,this.index))}else j(SyntaxError())}else{if(a=='"')break;d=d+a;this.index++}}if(b.charAt(this.index)=='"'){this.index++;return d}j(SyntaxError());default:f=this.index;if(a=="-"){i=p;a=b.charAt(++this.index)}if(a>="0"&&a<="9"){for(a=="0"&&(a=b.charAt(this.index+1),a>="0"&&a<="9")&&j(SyntaxError());this.index<c&&(a=b.charAt(this.index),a>="0"&&a<="9");this.index++);
  15 +if(b.charAt(this.index)=="."){for(h=++this.index;h<c&&(a=b.charAt(h),a>="0"&&a<="9");h++);h==this.index&&j(SyntaxError());this.index=h}a=b.charAt(this.index);if(a=="e"||a=="E"){a=b.charAt(++this.index);(a=="+"||a=="-")&&this.index++;for(h=this.index;h<c&&(a=b.charAt(h),a>="0"&&a<="9");h++);h==this.index&&j(SyntaxError());this.index=h}return+b.slice(f,this.index)}i&&j(SyntaxError());if(b.slice(this.index,this.index+4)=="true"){this.index=this.index+4;return p}if(b.slice(this.index,this.index+5)=="false"){this.index=
  16 +this.index+5;return x}if(b.slice(this.index,this.index+4)=="null"){this.index=this.index+4;return w}j(SyntaxError())}}return"$"},u.prototype.get=function(b){var c,a;b=="$"&&j(SyntaxError());if(typeof b=="string"){if(b.charAt(0)=="@")return b.slice(1);switch(b){case "[":for(c=[];;a||(a=p)){b=this.a();if(b=="]")break;if(a)if(b==","){b=this.a();b=="]"&&j(SyntaxError())}else j(SyntaxError());b==","&&j(SyntaxError());c.push(this.get(b))}return c;case "{":for(c={};;a||(a=p)){b=this.a();if(b=="}")break;
  17 +if(a)if(b==","){b=this.a();b=="}"&&j(SyntaxError())}else j(SyntaxError());b==","&&j(SyntaxError());(typeof b!="string"||b.charAt(0)!="@")&&j(SyntaxError());this.a()!=":"&&j(SyntaxError());c[b.slice(1)]=this.get(this.a())}return c}j(SyntaxError())}return b},v=function(b,c,a){var d=b[c],f,h;if(typeof d=="object"&&d)if(l.call(d)=="[object Array]")for(f=d.length;f--;){h=v(d,f,a);h===m?d.splice(f,1):d[f]=h}else C(d,function(b){var c=v(d,b,a);c===m?delete d[b]:d[b]=c});return a.call(b,c,d)},c.parse=function(b,
  18 +c){var a=new u(""+b),d=a.get(a.a()),f;a.a()!="$"&&j(SyntaxError());return c&&l.call(c)=="[object Function]"?v((f={},f[""]=d,f),"",c):d})}}).call(this);
  19 +}());
2  package.json
... ... @@ -1,6 +1,6 @@
1 1 {
2 2 "name": "json3",
3   - "version": "3.2.0",
  3 + "version": "3.2.1",
4 4 "description": "A modern JSON implementation compatible with nearly all JavaScript platforms.",
5 5 "homepage": "http://bestiejs.github.com/json3",
6 6 "main": "./lib/json3",

0 comments on commit 5ad5b67

Please sign in to comment.
Something went wrong with that request. Please try again.