Socket
Socket
Sign inDemoInstall

smart-buffer

Package Overview
Dependencies
1
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.1.1

6

build/smartbuffer.js

@@ -59,4 +59,3 @@ "use strict";

}
// Checks for buffer
if (arg1.buff) {
else if (arg1.buff) {
if (arg1.buff instanceof Buffer) {

@@ -70,2 +69,5 @@ this.buff = arg1.buff;

}
else {
this.buff = Buffer.allocUnsafe(DEFAULT_SMARTBUFFER_SIZE);
}
}

@@ -72,0 +74,0 @@ else if (typeof arg1 === 'object') {

{
"name": "smart-buffer",
"version": "1.1.0",
"version": "1.1.1",
"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",

@@ -65,2 +65,6 @@ var SmartBuffer = require('../build/smartbuffer');

var validOptions3 = {
encoding: 'utf8'
};
var invalidOptions1 = {

@@ -87,2 +91,8 @@ encoding: 'invalid'

assert.deepEqual(sbuff.buff, validOptions2.buff);
});
it('should create a SmartBuffer with the provided ascii encoding, and create a default buffer size', function () {
var sbuff = new SmartBuffer(validOptions3);
assert.strictEqual(sbuff.encoding, validOptions3.encoding);
assert.strictEqual(sbuff.buff.length, 4096);
})

@@ -132,2 +142,32 @@

});
describe('Constructing with factory methods', function () {
let originalBuffer = new Buffer(10);
var sbuff1 = SmartBuffer.fromBuffer(originalBuffer);
it('Should create a SmartBuffer with a provided internal Buffer as the initial value', function () {
assert.deepEqual(sbuff1.buff,originalBuffer);
});
var sbuff2 = SmartBuffer.fromSize(1024);
it('Should create a SmartBuffer with a set provided initial Buffer size', function () {
assert.strictEqual(sbuff2.buff.length, 1024);
});
var options = {
size: 1024,
encoding: 'ascii'
};
var sbuff3 = SmartBuffer.fromOptions(options);
it('Should create a SmartBuffer instance with a given SmartBufferOptions object', function () {
assert.strictEqual(sbuff3.encoding, options.encoding);
assert.strictEqual(sbuff3.buff.length, options.size);
});
});
});

@@ -134,0 +174,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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