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

varint

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

varint - npm Package Compare versions

Comparing version 4.0.1 to 5.0.0

5

decode.js

@@ -15,6 +15,5 @@ module.exports = read

do {
if(counter >= l) {
if (counter >= l) {
read.bytes = 0
read.bytesRead = 0 // DEPRECATED
return undefined
throw new RangeError('Could not decode varint')
}

@@ -21,0 +20,0 @@ b = buf[counter++]

2

package.json
{
"name": "varint",
"version": "4.0.1",
"version": "5.0.0",
"description": "protobuf-style varint bytes - use msb to create integer values of varying sizes",

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

@@ -28,2 +28,4 @@ # varint

Throws a `RangeError` when `data` does not represent a valid encoding.
### varint.decode.bytes

@@ -45,3 +47,3 @@

If varint is passed a buffer that does not contain a valid end
byte, then `decode` will return undefined, and `decode.bytes`
byte, then `decode` will throw `RangeError`, and `decode.bytes`
will be set to 0. If you are reading from a streaming source,

@@ -48,0 +50,0 @@ it's okay to pass an incomplete buffer into `decode`, detect this

@@ -127,6 +127,8 @@ var varint = require('./index')

while(l--) {
var val = decode(buffer.slice(0, l))
assert.equal(val, undefined)
assert.equal(decode.bytes, 0)
assert.equal(decode.bytesRead, 0)
try {
var val = decode(buffer.slice(0, l))
} catch (err) {
assert.equal(err.constructor, RangeError)
assert.equal(decode.bytes, 0)
}
}

@@ -133,0 +135,0 @@ 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