Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bytebuffer

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bytebuffer - npm Package Compare versions

Comparing version 3.0.0-RC1 to 3.0.0-RC2

2

bower.json
{
"name": "bytebuffer",
"version": "3.0.0-RC1",
"version": "3.0.0-RC2",
"author": "Daniel Wirtz <dcode@dcode.io>",

@@ -5,0 +5,0 @@ "description": "A full-featured ByteBuffer implementation using typed arrays.",

@@ -10,3 +10,3 @@ /*

b+": "+e);return{codePoint:e,length:b-c}}function r(a){if(0>a)throw RangeError("Illegal code point: "+a);if(128>a)return 1;if(2048>a)return 2;if(65536>a)return 3;if(1114112>a)return 4;throw RangeError("Illegal code point: "+a);}function t(a){for(var b,c=0,e=0;e<a.length;e++)b=a.charCodeAt(e),55296<=b&&57343>=b&&(b=a.codePointAt(e),65535<b&&e++),c+=r(b);return c}function u(a,b,c){var e=c;if(0>a)throw RangeError("Illegal code point: "+a);if(128>a)b.view.setUint8(c++,a&127);else if(2048>a)b.view.setUint8(c++,
a>>6&31|192),b.view.setUint8(c++,a&63|128);else if(65536>a)b.view.setUint8(c++,a>>12&15|224),b.view.setUint8(c++,a>>6&63|128),b.view.setUint8(c++,a&63|128);else if(1114112>a)b.view.setUint8(c++,a>>18&7|240),b.view.setUint8(c++,a>>12&63|128),b.view.setUint8(c++,a>>6&63|128),b.view.setUint8(c++,a&63|128);else throw RangeError("Illegal code point: "+a);return c-e}d.VERSION="3.0.0-RC1";d.LITTLE_ENDIAN=!0;d.BIG_ENDIAN=!1;d.DEFAULT_CAPACITY=16;d.DEFAULT_ENDIAN=d.BIG_ENDIAN;d.DEFAULT_NOASSERT=!1;d.Long=
a>>6&31|192),b.view.setUint8(c++,a&63|128);else if(65536>a)b.view.setUint8(c++,a>>12&15|224),b.view.setUint8(c++,a>>6&63|128),b.view.setUint8(c++,a&63|128);else if(1114112>a)b.view.setUint8(c++,a>>18&7|240),b.view.setUint8(c++,a>>12&63|128),b.view.setUint8(c++,a>>6&63|128),b.view.setUint8(c++,a&63|128);else throw RangeError("Illegal code point: "+a);return c-e}d.VERSION="3.0.0-RC2";d.LITTLE_ENDIAN=!0;d.BIG_ENDIAN=!1;d.DEFAULT_CAPACITY=16;d.DEFAULT_ENDIAN=d.BIG_ENDIAN;d.DEFAULT_NOASSERT=!1;d.Long=
k||null;var q=new ArrayBuffer(0);d.allocate=function(a,b,c){return new d(a,b,c)};d.concat=function(a,b,c,e){if("boolean"===typeof b||"string"!==typeof b)e=c,c=b,b=void 0;for(var h=0,f=0,g=a.length,l;f<g;++f)d.isByteBuffer(a[f])||(a[f]=d.wrap(a[f],b)),l=a[f].limit-a[f].offset,0<l&&(h+=l);if(0===h)return new d(0,c,e);b=new d(h,c,e);e=new Uint8Array(b.buffer);for(f=0;f<g;)c=a[f++],l=c.limit-c.offset,0>=l||(e.set((new Uint8Array(c.buffer)).subarray(c.offset,c.limit),b.offset),b.offset+=l);b.limit=b.offset;

@@ -45,5 +45,5 @@ b.offset=0;return b};d.isByteBuffer=function(a){return a&&a instanceof d};d.type=function(){return ArrayBuffer};d.wrap=function(a,b,c,e){"string"!==typeof b&&(e=c,c=b,b=void 0);if("string"===typeof a)switch("undefined"===typeof b&&(b="utf8"),b){case "base64":return d.fromBase64(a,c);case "hex":return d.fromHex(a,c);case "binary":return d.fromBinary(a,c);case "utf8":return d.fromUTF8(a,c);case "debug":return d.fromDebug(a,c);default:throw new TypeError("Unsupported encoding: "+b);}if(null===a||"object"!==

" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw new RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var c=a,e=0,d=0,f=0,g=0,g=this.view.getUint8(a++),e=g&127;if(g&128&&(g=this.view.getUint8(a++),e|=(g&127)<<7,g&128&&(g=this.view.getUint8(a++),e|=(g&127)<<14,g&128&&(g=this.view.getUint8(a++),e|=(g&127)<<21,g&128&&(g=this.view.getUint8(a++),d=g&127,g&128&&(g=this.view.getUint8(a++),d|=(g&127)<<7,g&128&&(g=this.view.getUint8(a++),d|=(g&127)<<14,g&128&&(g=
this.view.getUint8(a++),d|=(g&127)<<21,g&128&&(g=this.view.getUint8(a++),f=g&127,g&128&&(g=this.view.getUint8(a++),f|=(g&127)<<7,g&128))))))))))throw Error("Data must be corrupt: Buffer overrun");e=k.from28Bits(e,d,f,!1);return b?(this.offset=a,e):{value:e,length:a-c}},d.prototype.readVarint64ZigZag=function(a){a=this.readVarint64(a);"object"===typeof a?a.value=d.zigZagDecode64(a.value):a=d.zigZagDecode64(a);return a});d.prototype.writeCString=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);
var e,d=a.length;if(!this.noAssert){if("string"!==typeof a)throw new TypeError("Illegal str: Not a string");for(e=0;e<d;++e)if(0===a.codePointAt(e))throw new RangeError("Illegal str: Contains NULL-characters");if("number"!==typeof b||0!==b%1)throw new TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw new RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var f=b,d=t(a);b+=d+1;e=this.buffer.byteLength;b>e&&this.resize((e*=2)>
b?e:b);b-=d+1;e=0;for(d=a.length;e<d;++e)b+=u(a.codePointAt(e),this,b);this.view.setUint8(b++,0);return c?(this.offset=b,this):b-f};d.prototype.readCString=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw new TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw new RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var c=a,e,d=[];do{e=s(this,a);a+=e.length;if(0===
this.view.getUint8(a++),d|=(g&127)<<21,g&128&&(g=this.view.getUint8(a++),f=g&127,g&128&&(g=this.view.getUint8(a++),f|=(g&127)<<7,g&128))))))))))throw Error("Data must be corrupt: Buffer overrun");e=k.from28Bits(e,d,f,!1);return b?(this.offset=a,e):{value:e,length:a-c}},d.prototype.readVarint64ZigZag=function(a){(a=this.readVarint64(a))&&a.value instanceof k?a.value=d.zigZagDecode64(a.value):a=d.zigZagDecode64(a);return a});d.prototype.writeCString=function(a,b){var c="undefined"===typeof b;c&&(b=
this.offset);var e,d=a.length;if(!this.noAssert){if("string"!==typeof a)throw new TypeError("Illegal str: Not a string");for(e=0;e<d;++e)if(0===a.codePointAt(e))throw new RangeError("Illegal str: Contains NULL-characters");if("number"!==typeof b||0!==b%1)throw new TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw new RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var f=b,d=t(a);b+=d+1;e=this.buffer.byteLength;b>e&&this.resize((e*=
2)>b?e:b);b-=d+1;e=0;for(d=a.length;e<d;++e)b+=u(a.codePointAt(e),this,b);this.view.setUint8(b++,0);return c?(this.offset=b,this):b-f};d.prototype.readCString=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw new TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw new RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var c=a,e,d=[];do{e=s(this,a);a+=e.length;if(0===
e.codePoint)break;d.push(e.codePoint)}while(1);return b?(this.offset=a,String.fromCodePoint.apply(String,d)):{string:String.fromCodePoint.apply(String,d),length:a-c}};d.prototype.writeIString=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("string"!==typeof a)throw new TypeError("Illegal str: Not a string");if("number"!==typeof b||0!==b%1)throw new TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw new RangeError("Illegal offset: 0 <= "+

@@ -50,0 +50,0 @@ b+" (+0) <= "+this.buffer.byteLength);}var e=b,d;d=t(a);b+=4+d;var f=this.buffer.byteLength;b>f&&this.resize((f*=2)>b?f:b);b-=4+d;this.view.setUint32(b,d,this.littleEndian);b+=4;d=a.length;for(f=0;f<d;++f)b+=u(a.codePointAt(f),this,b);return c?(this.offset=b,this):b-e};d.prototype.readIString=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw new TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw new RangeError("Illegal offset: 0 <= "+

{
"name": "bytebuffer",
"version": "3.0.0-RC1",
"version": "3.0.0-RC2",
"author": "Daniel Wirtz <dcode@dcode.io>",

@@ -5,0 +5,0 @@ "description": "The swiss army knife for binary data in JavaScript.",

@@ -213,3 +213,3 @@ //? if (VARINT64) {

var val = this.readVarint64(offset);
if (typeof val === 'object')
if (val && val['value'] instanceof Long)
val["value"] = ByteBuffer.zigZagDecode64(val["value"]);

@@ -216,0 +216,0 @@ else

@@ -516,17 +516,19 @@ /*

var types = [
// name | alias | size | input | output | BE representation
["Int8" , "Byte" , 1 , 0xFE , -2 , "fe" ],
["Uint8" , null , 1 , -2 , 0xFE , "fe" ],
["Int16" , "Short" , 2 , 0xFFFE , -2 , "fffe" ],
["Uint16" , null , 2 , -2 , 0xFFFE , "fffe" ],
["Int32" , "Int" , 4 , 0xFFFFFFFE , -2 , "fffffffe" ],
["Uint32" , null , 4 , -2 , 0xFFFFFFFE , "fffffffe" ],
["Float32" , "Float" , 4 , 0.5 , 0.5 , "3f000000" ],
["Float64" , "Double", 8 , 0.1 , 0.1 , "3fb999999999999a" ],
["Int64" , "Long" , 8 , new Long(0xFFFFFFFE, 0xFFFFFFFF, true) , new Long(0xFFFFFFFE, 0xFFFFFFFF, false) , "fffffffffffffffe" ],
["Uint64" , null , 8 , new Long(0xFFFFFFFE, 0xFFFFFFFF, false) , new Long(0xFFFFFFFE, 0xFFFFFFFF, true) , "fffffffffffffffe" ],
// name | alias | size | input | output | BE representation
["Int8" , "Byte" , 1 , 0xFE , -2 , "fe" ],
["Uint8" , null , 1 , -2 , 0xFE , "fe" ],
["Int16" , "Short" , 2 , 0xFFFE , -2 , "fffe" ],
["Uint16" , null , 2 , -2 , 0xFFFE , "fffe" ],
["Int32" , "Int" , 4 , 0xFFFFFFFE , -2 , "fffffffe" ],
["Uint32" , null , 4 , -2 , 0xFFFFFFFE , "fffffffe" ],
["Float32" , "Float" , 4 , 0.5 , 0.5 , "3f000000" ],
["Float64" , "Double", 8 , 0.1 , 0.1 , "3fb999999999999a" ],
["Int64" , "Long" , 8 , new Long(0xFFFFFFFE, 0xFFFFFFFF, true) , new Long(0xFFFFFFFE, 0xFFFFFFFF, false) , "fffffffffffffffe" ],
["Uint64" , null , 8 , new Long(0xFFFFFFFE, 0xFFFFFFFF, false) , new Long(0xFFFFFFFE, 0xFFFFFFFF, true) , "fffffffffffffffe" ],
// name | alias | size | input | output | representation
["Varint32", null , 5 , 0xFFFFFFFE , -2 , "feffffff0f" ],
["Varint64", null , 10 , new Long(0xFFFFFFFE, 0xFFFFFFFF, true) , new Long(0xFFFFFFFE, 0xFFFFFFFF, false) , "feffffffffffffffff01"]
// name | alias | size | input | output | representation
["Varint32" , null , 5 , 0xFFFFFFFE , -2 , "feffffff0f" ],
["Varint32ZigZag", null , 1 , -1 , -1 , "01" ],
["Varint64" , null , 10 , new Long(0xFFFFFFFE, 0xFFFFFFFF, true) , new Long(0xFFFFFFFE, 0xFFFFFFFF, false) , "feffffffffffffffff01"],
["Varint64ZigZag", null , 1 , Long.fromNumber(-1) , Long.fromNumber(-1) , "01" ]
];

@@ -533,0 +535,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc