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

compact-encoding

Package Overview
Dependencies
Maintainers
3
Versions
25
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 2.12.0 to 2.13.0

27

index.js

@@ -381,2 +381,29 @@ const b4a = require('b4a')

exports.frame = function frame (enc) {
const dummy = exports.state()
return {
preencode (state, m) {
const end = state.end
enc.preencode(state, m)
uint.preencode(state, state.end - end)
},
encode (state, m) {
dummy.end = 0
enc.preencode(dummy, m)
uint.encode(state, dummy.end)
enc.encode(state, m)
},
decode (state) {
const end = state.end
const len = uint.decode(state)
state.end = state.start + len
const m = enc.decode(state)
state.start = state.end
state.end = end
return m
}
}
}
exports.json = {

@@ -383,0 +410,0 @@ preencode (state, v) {

2

package.json
{
"name": "compact-encoding",
"version": "2.12.0",
"version": "2.13.0",
"description": "A series of compact encoding schemes for building small and fast parsers and serializers",

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

@@ -674,1 +674,9 @@ const enc = require('./')

})
test('framed', function (t) {
const e = enc.frame(enc.uint)
t.alike(enc.encode(e, 42), b4a.from([0x01, 0x2a]))
t.alike(enc.decode(e, b4a.from([0x01, 0x2a])), 42)
t.alike(enc.encode(e, 4200), b4a.from([0x03, 0xfd, 0x68, 0x10]))
t.alike(enc.decode(e, b4a.from([0x03, 0xfd, 0x68, 0x10])), 4200)
})
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