Comparing version 0.1.1 to 1.0.0
@@ -167,2 +167,6 @@ function OffsetBuffer() { | ||
OffsetBuffer.prototype.peekUInt8 = function peekUInt8() { | ||
return this.buffers[0][this.offset]; | ||
}; | ||
OffsetBuffer.prototype.readUInt8 = function readUInt8() { | ||
@@ -169,0 +173,0 @@ this.size -= 1; |
{ | ||
"name": "obuf", | ||
"version": "0.1.1", | ||
"version": "1.0.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -56,2 +56,13 @@ var assert = require('assert'); | ||
describe('.peekUInt8', function() { | ||
it('should return and not move by one byte', function() { | ||
o.push(new Buffer([ 0x1, 0x2 ])); | ||
assert.equal(o.peekUInt8(), 1); | ||
assert.equal(o.readUInt8(), 1); | ||
assert.equal(o.peekUInt8(), 2); | ||
assert.equal(o.readUInt8(), 2); | ||
assert(o.isEmpty()); | ||
}); | ||
}); | ||
describe('.readUInt8', function() { | ||
@@ -148,2 +159,14 @@ it('should return and move by one byte', function() { | ||
}); | ||
describe('.has', function() { | ||
it('should properly check the amount of the remaining bytes', function() { | ||
o.push(new Buffer([ 1, 2, 3 ])); | ||
assert(o.has(3)); | ||
assert.equal(o.readUInt8(), 0x01); | ||
assert(!o.has(3)); | ||
assert(o.has(2)); | ||
assert.equal(o.readUInt16BE(), 0x0203); | ||
assert(!o.has(1)); | ||
}); | ||
}); | ||
}); |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13422
416
0