Created
June 17, 2013 11:34
-
-
Save daschl/5796268 to your computer and use it in GitHub Desktop.
Whitespace removed MsgPack Couchbase View library.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*!{id:msgpack.js,ver:1.05,license:"MIT",author:"uupaa.js@gmail.com"}*/ | |
/* Modified by @daschl and @avsej to strip out whats not needed */ | |
var msgunpack=function(){function k(){var g,d,e,b=0,f,h,c=m;d=c[++a];if(224<=d)return d-256;if(192>d){if(128>d)return d;144>d?(b=d-128,d=128):160>d?(b=d-144,d=144):(b=d-160,d=160)}switch(d){case 192:return null;case 194:return!1;case 195:return!0;case 202:return b=16777216*c[++a]+(c[++a]<<16)+(c[++a]<<8)+c[++a],f=b>>23&255,h=b&8388607,!b||2147483648===b?0:255===f?h?NaN:Infinity:(b&2147483648?-1:1)*(h|8388608)*Math.pow(2,f-127-23);case 203:b=16777216*c[++a]+(c[++a]<<16)+(c[++a]<<8)+c[++a];d=b&2147483648; | |
f=b>>20&2047;h=b&1048575;if(!b||2147483648===b)return a+=4,0;if(2047===f)return a+=4,h?NaN:Infinity;b=16777216*c[++a]+(c[++a]<<16)+(c[++a]<<8)+c[++a];return(d?-1:1)*((h|1048576)*Math.pow(2,f-1023-20)+b*Math.pow(2,f-1023-52));case 207:return b=16777216*c[++a]+(c[++a]<<16)+(c[++a]<<8)+c[++a],4294967296*b+16777216*c[++a]+(c[++a]<<16)+(c[++a]<<8)+c[++a];case 206:b+=16777216*c[++a]+(c[++a]<<16);case 205:b+=c[++a]<<8;case 204:return b+c[++a];case 211:return b=c[++a],b&128?-1*(72057594037927936*(b^255)+ | |
281474976710656*(c[++a]^255)+1099511627776*(c[++a]^255)+4294967296*(c[++a]^255)+16777216*(c[++a]^255)+65536*(c[++a]^255)+256*(c[++a]^255)+(c[++a]^255)+1):72057594037927936*b+281474976710656*c[++a]+1099511627776*c[++a]+4294967296*c[++a]+16777216*c[++a]+65536*c[++a]+256*c[++a]+c[++a];case 210:return b=16777216*c[++a]+(c[++a]<<16)+(c[++a]<<8)+c[++a],2147483648>b?b:b-4294967296;case 209:return b=(c[++a]<<8)+c[++a],32768>b?b:b-65536;case 208:return b=c[++a],128>b?b:b-256;case 219:b+=16777216*c[++a]+(c[++a]<< | |
16);case 218:b+=(c[++a]<<8)+c[++a];case 160:f=[];d=a;for(g=d+b;d<g;)e=c[++d],f.push(128>e?e:224>e?(e&31)<<6|c[++d]&63:(e&15)<<12|(c[++d]&63)<<6|c[++d]&63);a=d;return 10240>f.length?l.apply(null,f):n(f);case 223:b+=16777216*c[++a]+(c[++a]<<16);case 222:b+=(c[++a]<<8)+c[++a];case 128:for(h={};b--;){g=c[++a]-160;f=[];d=a;for(g=d+g;d<g;)e=c[++d],f.push(128>e?e:224>e?(e&31)<<6|c[++d]&63:(e&15)<<12|(c[++d]&63)<<6|c[++d]&63);a=d;h[l.apply(null,f)]=k()}return h;case 221:b+=16777216*c[++a]+(c[++a]<<16);case 220:b+= | |
(c[++a]<<8)+c[++a];case 144:for(f=[];b--;)f.push(k());return f}}function n(a){try{return l.apply(this,a)}catch(d){}for(var e=[],b=0,f=a.length,h=p;b<f;++b)e[b]=h[a[b]];return e.join("")}var j={},p={},m=[],a=0,l=String.fromCharCode;return function(g){var d;if("string"===typeof g){d=[];var e=g.split(""),b=-1,f;f=e.length;for(g=f%8;g--;)++b,d[b]=j[e[b]];for(g=f>>3;g--;)d.push(j[e[++b]],j[e[++b]],j[e[++b]],j[e[++b]],j[e[++b]],j[e[++b]],j[e[++b]],j[e[++b]])}else d=g;m=d;a=-1;return k()}}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment