🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

compact-encoding

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compact-encoding - npm Package Compare versions

Comparing version
3.0.1
to
3.1.0
+38
-0
index.js

@@ -108,2 +108,24 @@ const b4a = require('b4a')

const uint32be = (exports.uint32be = {
preencode(state, n) {
state.end += 4
},
encode(state, n) {
validateUint(n)
state.buffer[state.start++] = n >>> 24
state.buffer[state.start++] = n >>> 16
state.buffer[state.start++] = n >>> 8
state.buffer[state.start++] = n
},
decode(state) {
if (state.end - state.start < 4) throw new Error('Out of bounds')
return (
state.buffer[state.start++] * 0x1000000 +
state.buffer[state.start++] * 0x10000 +
state.buffer[state.start++] * 0x100 +
state.buffer[state.start++]
)
}
})
const uint40 = (exports.uint40 = {

@@ -173,2 +195,18 @@ preencode(state, n) {

exports.uint64be = {
preencode(state, n) {
state.end += 8
},
encode(state, n) {
validateUint(n)
const r = Math.floor(n / 0x100000000)
uint32be.encode(state, r)
uint32be.encode(state, n)
},
decode(state) {
if (state.end - state.start < 8) throw new Error('Out of bounds')
return 0x100000000 * uint32be.decode(state) + uint32be.decode(state)
}
}
const int = (exports.int = zigZagInt(uint))

@@ -175,0 +213,0 @@ exports.int8 = zigZagInt(uint8)

+1
-1
{
"name": "compact-encoding",
"version": "3.0.1",
"version": "3.1.0",
"description": "A series of compact encoding schemes for building small and fast parsers and serializers",

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