Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(819)

Side by Side Diff: samples/third_party/json/json2-min.js

Issue 1745002: Incremental progress toward archive loading in o3d-webgl. Implemented... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/o3d/
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/third_party/json/json2.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1
2 if(!this.JSON){this.JSON={};}
3 (function(){function f(n){return n<10?'0'+n:n;}
4 if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key ){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
5 f(this.getUTCMonth()+1)+'-'+
6 f(this.getUTCDate())+'T'+
7 f(this.getUTCHours())+':'+
8 f(this.getUTCMinutes())+':'+
9 f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJS ON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
10 var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u 2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600 -\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uf fff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r',' "':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return es capable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];retu rn typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);} )+'"':'"'+string+'"';}
11 function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if( value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.to JSON(key);}
12 if(typeof rep==='function'){value=rep.call(holder,key,value);}
13 switch(typeof value){case'string':return quote(value);case'number':return isFini te(value)?String(value):'null';case'boolean':case'null':return String(value);cas e'object':if(!value){return'null';}
14 gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Arra y]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null'; }
15 v=partial.length===0?'[]':gap?'[\n'+gap+
16 partial.join(',\n'+gap)+'\n'+
17 mind+']':'['+partial.join(',')+']';gap=mind;return v;}
18 if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i] ;if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':': ')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,v alue);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
19 v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
20 mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
21 if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,sp ace){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){in dent+=' ';}}else if(typeof space==='string'){indent=space;}
22 rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='obje ct'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
23 return str('',{'':value});};}
24 if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;funct ion walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object' ){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!= =undefined){value[k]=v;}else{delete value[k];}}}}
25 return reviver.call(holder,key,value);}
26 text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function (a){return'\\u'+
27 ('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
28 if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@'). replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']'). replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver= =='function'?walk({'':j},''):j;}
29 throw new SyntaxError('JSON.parse');};}}());
OLDNEW
« no previous file with comments | « samples/third_party/json/json2.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698