New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

protobuf-codec

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protobuf-codec - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

8

encode/wire-types.js

@@ -139,3 +139,3 @@ const assert = require('nanoassert')

const bigint = BigInt(int)
varint.encode(BigInt.asIntN(64, bigint), buf, byteOffset)
varint.encode(BigInt.asUintN(64, bigint), buf, byteOffset)
this.encode.bytes = varint.encode.bytes

@@ -147,3 +147,3 @@ return buf.subarray(byteOffset, byteOffset + this.encode.bytes)

assert(int <= this.MAX_VALUE, 'int exceeds MAX_VALUE')
return varint.encodingLength(int)
return varint.encodingLength(BigInt.asUintN(64, BigInt(int)))
},

@@ -196,3 +196,3 @@ MIN_VALUE: -(1n << 63n),

const bigint = BigInt(int)
varint.encode(BigInt.asIntN(32, bigint), buf, byteOffset)
varint.encode(BigInt.asUintN(32, bigint), buf, byteOffset)
this.encode.bytes = varint.encode.bytes

@@ -204,3 +204,3 @@ return buf.subarray(byteOffset, byteOffset + this.encode.bytes)

assert(int <= this.MAX_VALUE, 'int exceeds MAX_VALUE')
return varint.encodingLength(int)
return varint.encodingLength(BigInt.asUintN(32, BigInt(int)))
},

@@ -207,0 +207,0 @@ MIN_VALUE: -(1n << 31n),

{
"name": "protobuf-codec",
"version": "2.0.0",
"version": "2.0.1",
"description": "Minimal Protocol Buffers wire encoding/decoding",

@@ -5,0 +5,0 @@ "scripts": {

@@ -76,1 +76,30 @@ const test = require('tape')

})
test('int64 indentity', assert => {
const cases = [
encode.int64.MIN_VALUE,
encode.int64.MAX_VALUE,
0n,
1n,
-1n,
2n,
-2n,
63n,
-64n,
64n,
-65n,
2n ** 31n - 1n,
-(2n ** 31n),
2n ** 31n,
-(2n ** 31n - 1n),
// Two Number values
0,
1
]
cases.forEach(n => {
assert.equal(decode.int64(decodeWire.varint(encode.int64.encode(n))), BigInt(n))
})
assert.end()
})
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