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 1.0.0 to 1.1.0

4

encode.js

@@ -10,2 +10,3 @@ module.exports = encode

offset = offset || 0
var oldOffset = offset

@@ -17,3 +18,6 @@ while(num & MSBALL) {

out[offset] = num
encode.bytesWritten = offset - oldOffset + 1
return out
}

2

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

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

@@ -30,2 +30,6 @@ # varint

### varint.encode.bytesWritten
similar to `bytesRead` when encoding a number it can be useful to know how many bytes where written (especially if you pass an output array). you can access this via `varint.encode.bytesWritten` which holds the number of bytes written in the last encode.
## usage notes

@@ -32,0 +36,0 @@

@@ -63,2 +63,3 @@ var varint = require('./index')

assert.deepEqual(encode(expected), [expected])
assert.equal(encode.bytesWritten, 1)
assert.end()

@@ -70,2 +71,3 @@ })

assert.deepEqual(encode(expected), [0x80, 0x1E])
assert.equal(encode.bytesWritten, 2)
assert.end()

@@ -72,0 +74,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