Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ref

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ref - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

6

History.md
0.3.3 / 2014-12-29
==================
* package: allow any "debug" v2
* add support for `Buffer#reinterpret()` with `offset` (#18, @deepak1556)
0.3.2 / 2014-06-19

@@ -3,0 +9,0 @@ ==================

8

lib/ref.js

@@ -1370,4 +1370,4 @@

Buffer.prototype.reinterpret = function reinterpret (size) {
return exports.reinterpret(this, size)
Buffer.prototype.reinterpret = function reinterpret (size, offset) {
return exports.reinterpret(this, size, offset)
}

@@ -1379,4 +1379,4 @@

Buffer.prototype.reinterpretUntilZeros = function reinterpretUntilZeros (size) {
return exports.reinterpretUntilZeros(this, size)
Buffer.prototype.reinterpretUntilZeros = function reinterpretUntilZeros (size, offset) {
return exports.reinterpretUntilZeros(this, size, offset)
}

@@ -1383,0 +1383,0 @@

@@ -20,3 +20,3 @@ {

],
"version": "0.3.2",
"version": "0.3.3",
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)",

@@ -34,3 +34,3 @@ "repository": {

"bindings": "~1.2.0",
"debug": "~1.0.1",
"debug": "2",
"nan": "~1.2.0"

@@ -37,0 +37,0 @@ },

@@ -20,2 +20,14 @@

})
it('should return a new Buffer instance starting at the offset address', function () {
var buf = new Buffer('hello world')
var offset = 3
var small = buf.slice(offset, buf.length)
assert.strictEqual(buf.length - offset, small.length)
assert.strictEqual(buf.address() + offset, small.address())
var reinterpreted = buf.reinterpret(small.length, offset)
assert.strictEqual(small.address(), reinterpreted.address())
assert.strictEqual(small.length, reinterpreted.length)
assert.strictEqual(small.toString(), reinterpreted.toString())
})

@@ -22,0 +34,0 @@ it('should retain a reference to the original Buffer when reinterpreted', function () {

@@ -17,2 +17,9 @@

})
it('should return a new Buffer instance up until the first 0 starting from offset', function () {
var buf = new Buffer('hello\0world')
var buf2 = buf.reinterpretUntilZeros(1, 3)
assert.equal(buf2.length, 'lo'.length)
assert.equal(buf2.toString(), 'lo')
})

@@ -19,0 +26,0 @@ it('should return a new Buffer instance up until the first 2-byte sequence of 0s', function () {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc