Socket
Socket
Sign inDemoInstall

obuf

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 1.0.0

4

index.js

@@ -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;

2

package.json
{
"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));
});
});
});
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc