Skip to content

Instantly share code, notes, and snippets.

@soggie
Created May 8, 2013 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soggie/5537982 to your computer and use it in GitHub Desktop.
Save soggie/5537982 to your computer and use it in GitHub Desktop.

Normal:

function (d,e,f){var g=a.call(this,d,e,f);if(g){if(-1<g.indexOf('\u2028'))g=g.replace(b,'\\u2028');if(-1<g.indexOf('\u2029'))g=g.replace(c,'\\u2029');}return g;}

CNN:

function (a,g){var h,e,b,f="",d;switch(typeof a){case"object":if(a){if(a.______array=="______array"){for(e=0;e<a.length;++e){d=this.stringify(a[e]);if(f){f+=",";}f+=d;}return"["+f+"]";}else{if(typeof a.toString!="undefined"){for(e in a){d=a[e];if(typeof d!="undefined"&&typeof d!="function"){d=this.stringify(d);if(f){f+=",";}f+=this.stringify(e,true)+":"+d;}}return"{"+f+"}";}}}return"null";case"number":return isFinite(a)?String(a):"null";case"string":b=a.length;if(!g){f='"';}for(e=0;e<b;e+=1){h=a.charAt(e);if(h>=" "){if(h=="\\"||h=='"'){f+="\\";}f+=h;}else{switch(h){case"\b":f+="\\b";break;case"\f":f+="\\f";break;case"\n":f+="\\n";break;case"\r":f+="\\r";break;case"\t":f+="\\t";break;default:h=h.charCodeAt();f+="\\u00"+Math.floor(h/16).toString(16)+(h%16).toString(16);}}}if(!g){return f+'"';}else{return f;}case"boolean":return String(a);default:return"null";}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment