From 887737695851c140e75a966167c965a9d481084b Mon Sep 17 00:00:00 2001 From: Zhipeng Jia Date: Fri, 11 Jun 2021 13:20:39 -0500 Subject: [PATCH] Bump v0.6.1 --- bower.json | 2 +- dist/snappyjs.js | 10 +++++----- dist/snappyjs.min.js | 4 ++-- package.json | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bower.json b/bower.json index bb7473a..36e251c 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "snappyjs", "main": "./dist/snappyjs.js", - "version": "0.6.0", + "version": "0.6.1", "homepage": "https://github.com/zhipeng-jia/snappyjs", "authors": [ "Zhipeng Jia " diff --git a/dist/snappyjs.js b/dist/snappyjs.js index b6a6ceb..d20b8f1 100644 --- a/dist/snappyjs.js +++ b/dist/snappyjs.js @@ -5,7 +5,7 @@ * snappyjs: * license: MIT (http://opensource.org/licenses/MIT) * author: Zhipeng Jia - * version: 0.6.0 + * version: 0.6.1 * * This header is generated by licensify (https://github.com/twada/licensify) */ @@ -159,13 +159,13 @@ function compress (uncompressed) { length = compressor.compressToBuffer(compressed) } if (!compressed.slice) { // ie11 - var compressedArray = new Uint8Array(Array.prototype.slice.call(compressed, 0, length)); + var compressedArray = new Uint8Array(Array.prototype.slice.call(compressed, 0, length)) if (uint8Mode) { - return compressedArray; + return compressedArray } else if (arrayBufferMode) { - return compressedArray.buffer; + return compressedArray.buffer } else { - throw new Error("not implemented"); + throw new Error('Not implemented') } } diff --git a/dist/snappyjs.min.js b/dist/snappyjs.min.js index 784b7d9..83df1fb 100644 --- a/dist/snappyjs.min.js +++ b/dist/snappyjs.min.js @@ -5,7 +5,7 @@ * snappyjs: * license: MIT (http://opensource.org/licenses/MIT) * author: Zhipeng Jia - * version: 0.6.0 + * version: 0.6.1 * * This header is generated by licensify (https://github.com/twada/licensify) */ @@ -13,7 +13,7 @@ var SnappyJS=window.SnappyJS||{};SnappyJS.uncompress=require("./index").uncompress,SnappyJS.compress=require("./index").compress,window.SnappyJS=SnappyJS; },{"./index":2}],2:[function(require,module,exports){ -"use strict";function isNode(){return"object"==typeof process&&"object"==typeof process.versions&&void 0!==process.versions.node}function isUint8Array(r){return r instanceof Uint8Array&&(!isNode()||!Buffer.isBuffer(r))}function isArrayBuffer(r){return r instanceof ArrayBuffer}function isBuffer(r){return!!isNode()&&Buffer.isBuffer(r)}var SnappyDecompressor=require("./snappy_decompressor").SnappyDecompressor,SnappyCompressor=require("./snappy_compressor").SnappyCompressor,TYPE_ERROR_MSG="Argument compressed must be type of ArrayBuffer, Buffer, or Uint8Array";function uncompress(r){if(!isUint8Array(r)&&!isArrayBuffer(r)&&!isBuffer(r))throw new TypeError(TYPE_ERROR_MSG);var e=!1,s=!1;isUint8Array(r)?e=!0:isArrayBuffer(r)&&(s=!0,r=new Uint8Array(r));var n,o,f=new SnappyDecompressor(r),i=f.readUncompressedLength();if(-1===i)throw new Error("Invalid Snappy bitstream");if(e){if(n=new Uint8Array(i),!f.uncompressToBuffer(n))throw new Error("Invalid Snappy bitstream")}else if(s){if(n=new ArrayBuffer(i),o=new Uint8Array(n),!f.uncompressToBuffer(o))throw new Error("Invalid Snappy bitstream")}else if(n=Buffer.alloc(i),!f.uncompressToBuffer(n))throw new Error("Invalid Snappy bitstream");return n}function compress(r){if(!isUint8Array(r)&&!isArrayBuffer(r)&&!isBuffer(r))throw new TypeError(TYPE_ERROR_MSG);var e=!1,s=!1;isUint8Array(r)?e=!0:isArrayBuffer(r)&&(s=!0,r=new Uint8Array(r));var n,o,f,i=new SnappyCompressor(r),t=i.maxCompressedLength();if(e?(n=new Uint8Array(t),f=i.compressToBuffer(n)):s?(n=new ArrayBuffer(t),o=new Uint8Array(n),f=i.compressToBuffer(o)):(n=Buffer.alloc(t),f=i.compressToBuffer(n)),!n.slice){var p=new Uint8Array(Array.prototype.slice.call(n,0,f));if(e)return p;if(s)return p.buffer;throw new Error("not implemented")}return n.slice(0,f)}exports.uncompress=uncompress,exports.compress=compress; +"use strict";function isNode(){return"object"==typeof process&&"object"==typeof process.versions&&void 0!==process.versions.node}function isUint8Array(r){return r instanceof Uint8Array&&(!isNode()||!Buffer.isBuffer(r))}function isArrayBuffer(r){return r instanceof ArrayBuffer}function isBuffer(r){return!!isNode()&&Buffer.isBuffer(r)}var SnappyDecompressor=require("./snappy_decompressor").SnappyDecompressor,SnappyCompressor=require("./snappy_compressor").SnappyCompressor,TYPE_ERROR_MSG="Argument compressed must be type of ArrayBuffer, Buffer, or Uint8Array";function uncompress(r){if(!isUint8Array(r)&&!isArrayBuffer(r)&&!isBuffer(r))throw new TypeError(TYPE_ERROR_MSG);var e=!1,s=!1;isUint8Array(r)?e=!0:isArrayBuffer(r)&&(s=!0,r=new Uint8Array(r));var n,o,f=new SnappyDecompressor(r),i=f.readUncompressedLength();if(-1===i)throw new Error("Invalid Snappy bitstream");if(e){if(n=new Uint8Array(i),!f.uncompressToBuffer(n))throw new Error("Invalid Snappy bitstream")}else if(s){if(n=new ArrayBuffer(i),o=new Uint8Array(n),!f.uncompressToBuffer(o))throw new Error("Invalid Snappy bitstream")}else if(n=Buffer.alloc(i),!f.uncompressToBuffer(n))throw new Error("Invalid Snappy bitstream");return n}function compress(r){if(!isUint8Array(r)&&!isArrayBuffer(r)&&!isBuffer(r))throw new TypeError(TYPE_ERROR_MSG);var e=!1,s=!1;isUint8Array(r)?e=!0:isArrayBuffer(r)&&(s=!0,r=new Uint8Array(r));var n,o,f,i=new SnappyCompressor(r),t=i.maxCompressedLength();if(e?(n=new Uint8Array(t),f=i.compressToBuffer(n)):s?(n=new ArrayBuffer(t),o=new Uint8Array(n),f=i.compressToBuffer(o)):(n=Buffer.alloc(t),f=i.compressToBuffer(n)),!n.slice){var p=new Uint8Array(Array.prototype.slice.call(n,0,f));if(e)return p;if(s)return p.buffer;throw new Error("Not implemented")}return n.slice(0,f)}exports.uncompress=uncompress,exports.compress=compress; },{"./snappy_compressor":3,"./snappy_decompressor":4}],3:[function(require,module,exports){ "use strict";var BLOCK_LOG=16,BLOCK_SIZE=1<>>a}function load32(r,a){return r[a]+(r[a+1]<<8)+(r[a+2]<<16)+(r[a+3]<<24)}function equals32(r,a,e){return r[a]===r[e]&&r[a+1]===r[e+1]&&r[a+2]===r[e+2]&&r[a+3]===r[e+3]}function copyBytes(r,a,e,o,n){var t;for(t=0;t>>8,n+=3),copyBytes(r,a,o,n,e),n+e}function emitCopyLessThan64(r,a,e,o){return o<12&&e<2048?(r[a]=1+(o-4<<2)+(e>>>8<<5),r[a+1]=255&e,a+2):(r[a]=2+(o-1<<2),r[a+1]=255&e,r[a+2]=e>>>8,a+3)}function emitCopy(r,a,e,o){for(;o>=68;)a=emitCopyLessThan64(r,a,e,64),o-=64;return o>64&&(a=emitCopyLessThan64(r,a,e,60),o-=60),emitCopyLessThan64(r,a,e,o)}function compressFragment(r,a,e,o,n){for(var t=1;1<=15)for(p=B-15,l=hashFunc(load32(r,a+=1),s);b;){m=32,f=a;do{if(h=l,y=m>>>5,m+=1,f=(a=f)+y,a>p){b=!1;break}l=hashFunc(load32(r,f),s),c=S+u[h],u[h]=a-S}while(!equals32(r,a,c));if(!b)break;n=emitLiteral(r,_,a-_,o,n);do{for(L=a,C=4;a+C=p){b=!1;break}u[hashFunc(load32(r,a-1),s)]=a-1-S,c=S+u[T=hashFunc(load32(r,a),s)],u[T]=a-S}while(equals32(r,a,c));if(!b)break;l=hashFunc(load32(r,a+=1),s)}return _>>=7)>0&&(a[e]+=128),e+=1}while(r>0);return e}function SnappyCompressor(r){this.array=r}SnappyCompressor.prototype.maxCompressedLength=function(){var r=this.array.length;return 32+r+Math.floor(r/6)},SnappyCompressor.prototype.compressToBuffer=function(r){var a,e=this.array,o=e.length,n=0,t=0;for(t=putVarint(o,r,t);n