diff --git a/ByteBuffer.js b/ByteBuffer.js index c0b939b..a929d71 100644 --- a/ByteBuffer.js +++ b/ByteBuffer.js @@ -111,7 +111,7 @@ * @const * @expose */ - ByteBuffer.VERSION = "2.3.1"; + ByteBuffer.VERSION = "2.3.2"; /** * Default buffer capacity of `16`. The ByteBuffer will be automatically resized by a factor of 2 if required. diff --git a/ByteBuffer.min.js b/ByteBuffer.min.js index 4bc46b7..a2525a9 100644 --- a/ByteBuffer.min.js +++ b/ByteBuffer.min.js @@ -3,7 +3,7 @@ Released under the Apache License, Version 2.0 see: https://github.com/dcodeIO/ByteBuffer.js for details */ -(function(n){function q(l){function c(a,b,d){a="undefined"!==typeof a?parseInt(a,10):c.DEFAULT_CAPACITY;1>a&&(a=c.DEFAULT_CAPACITY);this.array=d?null:new ArrayBuffer(a);this.view=d?null:new DataView(this.array);this.offset=0;this.markedOffset=-1;this.length=0;this.littleEndian="undefined"!=typeof b?!!b:!1}var p=null;if("function"===typeof require)try{var n=require("buffer"),p=n&&"function"===typeof n.Buffer&&"function"===typeof n.Buffer.isBuffer?n.Buffer:null}catch(q){}c.VERSION="2.3.1";c.DEFAULT_CAPACITY= +(function(n){function q(l){function c(a,b,d){a="undefined"!==typeof a?parseInt(a,10):c.DEFAULT_CAPACITY;1>a&&(a=c.DEFAULT_CAPACITY);this.array=d?null:new ArrayBuffer(a);this.view=d?null:new DataView(this.array);this.offset=0;this.markedOffset=-1;this.length=0;this.littleEndian="undefined"!=typeof b?!!b:!1}var p=null;if("function"===typeof require)try{var n=require("buffer"),p=n&&"function"===typeof n.Buffer&&"function"===typeof n.Buffer.isBuffer?n.Buffer:null}catch(q){}c.VERSION="2.3.2";c.DEFAULT_CAPACITY= 16;c.LITTLE_ENDIAN=!0;c.BIG_ENDIAN=!1;c.Long=l||null;c.isByteBuffer=function(a){return a&&(a instanceof c||"object"===typeof a&&(null===a.array||a.array instanceof ArrayBuffer)&&(null===a.view||a.view instanceof DataView)&&"number"===typeof a.offset&&"number"===typeof a.markedOffset&&"number"===typeof a.length&&"boolean"===typeof a.littleEndian)};c.allocate=function(a,b){return new c(a,b)};c.wrap=function(a,b,d){"boolean"===typeof b&&(d=b,b="utf8");if("string"===typeof a)switch(b){case "base64":return c.decode64(a, d);case "hex":return c.decodeHex(a,d);case "binary":return c.decodeBinary(a,d);default:return(new c(c.DEFAULT_CAPACITY,d)).writeUTF8String(a).flip()}if(p&&p.isBuffer(a)){b=(new Uint8Array(a)).buffer;if(b===a){b=new ArrayBuffer(a.length);for(var e=new Uint8Array(b),f=0,g=a.length;fa)return!1;null===this.array&&(this.array=new ArrayBuffer(a),this.view=new DataView(this.array));if(this.array.byteLength", "description": "A full-featured ByteBuffer implementation using typed arrays.", "main": "ByteBuffer.js", diff --git a/package.json b/package.json index cb17fb5..d6d652f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bytebuffer", - "version": "2.3.1", + "version": "2.3.2", "author": "Daniel Wirtz ", "description": "A full-featured ByteBuffer implementation using typed arrays.", "main": "ByteBuffer.js", @@ -13,12 +13,12 @@ }, "keywords": ["net", "array", "buffer", "arraybuffer", "typed array", "bytebuffer", "json", "websocket", "webrtc"], "dependencies": { - "long": "latest" + "long": "~1" }, "devDependencies": { - "testjs": "latest", - "preprocessor": "latest", - "closurecompiler": "latest" + "testjs": "~1", + "preprocessor": "~1.4", + "closurecompiler": "~1" }, "license": "Apache-2.0", "engines": { diff --git a/tests/suite.js b/tests/suite.js index 06196ff..de552cd 100644 --- a/tests/suite.js +++ b/tests/suite.js @@ -424,19 +424,14 @@ var suite = { "write/readUint64": function(test) { var bb = new ByteBuffer(8); - var max = ByteBuffer.Long.MAX_UNSIGNED_VALUE.toNumber(); + var max = ByteBuffer.Long.MAX_UNSIGNED_VALUE; bb.writeUint64(max).flip(); test.equal(bb.toString("debug"), ""); - test.equal(bb.readUint64(0), max); - - var min = ByteBuffer.Long.MIN_UNSIGNED_VALUE.toNumber(); - bb.writeLong(min).flip(); - test.equal(bb.toString("debug"), "<00 00 00 00 00 00 00 00>"); - test.equal(bb.readUint64(0), min); + test.deepEqual(bb.readUint64(0), max); bb.writeUint64(-1).flip(); - test.equal(bb.toString("debug"), "<00 00 00 00 00 00 00 00>"); - test.equal(bb.readUint64(0), 0); + test.equal(bb.toString("debug"), ""); + test.deepEqual(bb.readUint64(0), ByteBuffer.Long.fromNumber(-1, true)); bb.reset(); bb.LE().writeUint64(new ByteBuffer.Long(0x89ABCDEF, 0x01234567, true)).flip();