Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

cborg

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cborg - npm Package Compare versions

Comparing version
4.5.7
to
4.5.8
+7
-0
CHANGELOG.md

@@ -0,1 +1,8 @@

## [4.5.8](https://github.com/rvagg/cborg/compare/v4.5.7...v4.5.8) (2026-01-21)
### Bug Fixes
* **cli:** don't omit array length bytes in diagnostic output ([b8dacb6](https://github.com/rvagg/cborg/commit/b8dacb652c02566c7b64c2638b7bcb36bb519b6b))
* **test:** add CLI tests to `npm test` ([b19bc87](https://github.com/rvagg/cborg/commit/b19bc87ea04691f9173a5b13284e21192e0f1e3c))
## [4.5.7](https://github.com/rvagg/cborg/compare/v4.5.6...v4.5.7) (2026-01-21)

@@ -2,0 +9,0 @@

+10
-3

@@ -50,5 +50,12 @@ import { Tokeniser } from './decode.js'

case 'array':
// for bytes and string, we want to print out the length part of the value prefix if it
// exists - it exists for short lengths (<24) but does for longer lengths
multilen = token.type.name === 'string' ? utf8Encoder.encode(token.value).length : token.value.length
// print the length bytes if they exist (length >= 24)
// for string/bytes, token.value is the content; for array/map, token.value IS the count
if (token.type.name === 'string') {
multilen = utf8Encoder.encode(token.value).length
} else if (token.type.name === 'bytes') {
multilen = token.value.length
} else {
// array or map - value is the count directly
multilen = token.value
}
if (multilen >= uintBoundaries[0]) {

@@ -55,0 +62,0 @@ if (multilen < uintBoundaries[1]) {

{
"name": "cborg",
"version": "4.5.7",
"version": "4.5.8",
"description": "Fast CBOR with a focus on strictness",

@@ -16,4 +16,5 @@ "main": "cborg.js",

"test:node": "c8 --check-coverage --exclude=test/** mocha test/test-*.js",
"test:node-bin": "mocha test/node-test-bin.js",
"test:browser": "polendina --cleanup test/test-*.js",
"test": "npm run lint && npm run build && npm run test:node && npm run test:browser",
"test": "npm run lint && npm run build && npm run test:node && npm run test:node-bin && npm run test:browser",
"test:ci": "npm run test",

@@ -20,0 +21,0 @@ "coverage": "c8 --reporter=html --reporter=text mocha test/test-*.js && npx st -d coverage -p 8888"

@@ -100,3 +100,3 @@ /* eslint-env mocha */

Valid commands:
\tbin2diag [binary input]
\tbin2diag [--width <width>] [binary input]
\tbin2hex [binary input]

@@ -108,6 +108,6 @@ \tbin2json [--pretty] [binary input]

\thex2bin [hex input]
\thex2diag [hex input]
\thex2diag [--width <width>] [hex input]
\thex2json [--pretty] [hex input]
\tjson2bin '[json input]'
\tjson2diag '[json input]'
\tjson2diag [--width <width>] '[json input]'
\tjson2hex '[json input]'

@@ -129,3 +129,3 @@ Input may either be supplied as an argument or piped via stdin

Valid commands:
\tbin2diag [binary input]
\tbin2diag [--width <width>] [binary input]
\tbin2hex [binary input]

@@ -137,6 +137,6 @@ \tbin2json [--pretty] [binary input]

\thex2bin [hex input]
\thex2diag [hex input]
\thex2diag [--width <width>] [hex input]
\thex2json [--pretty] [hex input]
\tjson2bin '[json input]'
\tjson2diag '[json input]'
\tjson2diag [--width <width>] '[json input]'
\tjson2hex '[json input]'

@@ -154,3 +154,3 @@ Input may either be supplied as an argument or piped via stdin

Valid commands:
\tbin2diag [binary input]
\tbin2diag [--width <width>] [binary input]
\tbin2hex [binary input]

@@ -162,6 +162,6 @@ \tbin2json [--pretty] [binary input]

\thex2bin [hex input]
\thex2diag [hex input]
\thex2diag [--width <width>] [hex input]
\thex2json [--pretty] [hex input]
\tjson2bin '[json input]'
\tjson2diag '[json input]'
\tjson2diag [--width <width>] '[json input]'
\tjson2hex '[json input]'

@@ -350,2 +350,19 @@ Input may either be supplied as an argument or piped via stdin

describe('diag length bytes', () => {
// issue #137 - array and map length bytes were missing for lengths >= 24
it('array with 24 elements', async () => {
// 98 18 = array(24), then 24 uint(1) values
const hex = '9818' + '01'.repeat(24)
const { stdout, stderr } = await execBin(`hex2diag ${hex}`)
assert.strictEqual(stderr, '')
assert.ok(stdout.startsWith('98 18 # array(24)\n'))
})
it('map with 24 entries', async () => {
// b8 18 = map(24), then 24 pairs of string('a')=uint(1)
const hex = 'b818' + '616101'.repeat(24)
const { stdout, stderr } = await execBin(`hex2diag ${hex}`)
assert.strictEqual(stderr, '')
assert.ok(stdout.startsWith('b8 18 # map(24)\n'))
})
it('compact', async () => {

@@ -352,0 +369,0 @@ const { stdout, stderr } = await execBin('json2diag', '"aaaaaaaaaaaaaaaaaaaaaaa"')

Sorry, the diff of this file is not supported yet