smart-buffer
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -425,3 +425,3 @@ "use strict"; | ||
readString(length, encoding) { | ||
const lengthVal = Math.min(length, this.length - this.readOffset) || this.length - this.readOffset; | ||
const lengthVal = (typeof length === 'number') ? Math.min(length, this.length - this.readOffset) : this.length - this.readOffset; | ||
const value = this.buff.slice(this.readOffset, this.readOffset + lengthVal).toString(encoding || this.encoding); | ||
@@ -428,0 +428,0 @@ this.readOffset += lengthVal; |
# Change Log | ||
## 3.0.1 | ||
> Released 02/15/2017 | ||
### Bug Fixes | ||
* Fixes a bug leftover from the TypeScript refactor where .readIntXXX() resulted in .readUIntXXX() being called by mistake. | ||
## 3.0 | ||
@@ -25,2 +30,2 @@ > Released 02/12/2017 | ||
### Bug Fixes: | ||
* Fixes a bug where reading null terminated strings may result in an exception. | ||
* Fixes a bug where reading null terminated strings may result in an exception. |
{ | ||
"name": "smart-buffer", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "A smarter Buffer that keeps track of its own read and write positions while growing endlessly.", | ||
@@ -5,0 +5,0 @@ "main": "build/smartbuffer.js", |
@@ -283,2 +283,6 @@ var SmartBuffer = require('../build/smartbuffer').SmartBuffer; | ||
it('should return an empty string', function () { | ||
assert.strictEqual(reader.readString(0), ''); | ||
}); | ||
it('should equal: bleh', function () { | ||
@@ -285,0 +289,0 @@ assert.strictEqual(reader.readStringNT(), 'bleh'); |
Sorry, the diff of this file is not supported yet
90982
1608