You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

varintes

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

varintes - npm Package Compare versions

Comparing version

to
2.0.0-a.3

3

dist/decode.d.ts

@@ -5,4 +5,5 @@ /**

* @param buffer - input that contains an encoded varint.
* @param offset
* @return [decoded-varint, bytes-read]
*/
export declare function decode(buffer: Uint8Array): [number, number];
export declare function decode(buffer: Uint8Array, offset?: number): [number, number];

@@ -19,7 +19,8 @@ const MSB = 0x80; // 1000 0000

* @param buffer - input that contains an encoded varint.
* @param offset
* @return [decoded-varint, bytes-read]
*/
export function decode(buffer) {
export function decode(buffer, offset = 0) {
let result = 0;
let bytesRead = 0;
let bytesRead = offset;
let byte = 0;

@@ -36,3 +37,3 @@ let shift = 0;

}
return [result, bytesRead];
return [result, bytesRead - offset];
}
{
"name": "varintes",
"version": "2.0.0-a.2",
"version": "2.0.0-a.3",
"description": "Unsigned Varint encoding and decoding, exposed as ESModule",

@@ -21,3 +21,2 @@ "keywords": [

],
"main": "dist/index.js",
"sideEffects": false,

@@ -24,0 +23,0 @@ "typesVersions": {