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

msgpack5

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msgpack5 - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

8

lib/decoder.js

@@ -117,4 +117,5 @@ var bl = require('bl')

, length
, result
, result = 0
, type
, bytePos

@@ -146,3 +147,6 @@ if (!hasMinBufferSize(first, bufLength)) {

// 8-bytes BE unsigned int
result = buf.readUInt32BE(offset + 5) * 0xffffffff + buf.readUInt32BE(offset + 1)
// Read long byte by byte, big-endian
for (bytePos = 7; bytePos >= 0; bytePos--) {
result += (buf.readUInt8(offset + bytePos + 1) * Math.pow(2 , (8 *(7-bytePos))));
}
return buildDecodeResult(result, 9)

@@ -149,0 +153,0 @@ case 0xd0:

@@ -222,5 +222,7 @@

function write64BitUint(buf, obj) {
var big = Math.floor(obj / 0xffffffff)
buf.writeUInt32BE(big, 5)
buf.writeUInt32BE(obj - big * 0xffffffff, 1)
// Write long byte by byte, in big-endian order
for (var currByte = 7; currByte >= 0; currByte--) {
buf[currByte + 1] = (obj & 0xff);
obj = obj / 256;
}
}

@@ -227,0 +229,0 @@

{
"name": "msgpack5",
"version": "2.1.0",
"version": "2.2.0",
"description": "A msgpack v5 implementation for node.js and the browser, with extension points",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -9,3 +9,2 @@

, allNum = []
, base = 0xffffffff

@@ -16,3 +15,2 @@ allNum.push(0xffffffff)

allNum.forEach(function(num) {

@@ -23,3 +21,7 @@ t.test('encoding ' + num, function(t) {

t.equal(buf[0], 0xcf, 'must have the proper header')
t.equal(buf.readUInt32BE(5) * base + buf.readUInt32BE(1), num, 'must decode correctly');
var result = 0;
for (var k = 7; k >= 0; k--) {
result += (buf.readUInt8(k + 1) * Math.pow(2 , (8 *(7-k))));
}
t.equal(result, num, 'must decode correctly');
t.end()

@@ -26,0 +28,0 @@ })

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