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

cbor-x

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cbor-x - npm Package Compare versions

Comparing version 0.8.1 to 0.8.2

tests/test-compatibility.cjs

16

decode.js

@@ -342,6 +342,14 @@ "use strict"

if (string == null) {
strings = extractStrings(position, srcEnd, length, src)
stringPosition = 0
srcStringEnd = 1 // even if a utf-8 string was decoded, must indicate we are in the midst of extracted strings and can't skip strings
string = strings[stringPosition++]
let extraction = extractStrings(position, srcEnd, length, src)
if (typeof extraction == 'string') {
string = extraction
strings = EMPTY_ARRAY
} else {
strings = extraction
stringPosition = 1
srcStringEnd = 1 // even if a utf-8 string was decoded, must indicate we are in the midst of extracted strings and can't skip strings
string = strings[0]
if (string === undefined)
throw new Error('Unexpected end of buffer')
}
}

@@ -348,0 +356,0 @@ let srcStringLength = string.length

@@ -9,8 +9,6 @@ export { Encoder, addExtension, encode, NEVER, ALWAYS, DECIMAL_ROUND, DECIMAL_FIT } from './encode.js'

const extractor = tryRequire('msgpackr-extract')
const extractor = tryRequire('cbor-extract')
if (extractor)
setExtractor(extractor.extractStrings)
/*
Object.assign(exports, unpackModule.FLOAT32_OPTIONS)
*/
function tryRequire(moduleId) {

@@ -22,6 +20,6 @@ try {

if (typeof window == 'undefined')
console.warn('Native extraction module not loaded, msgpackr will still run, but with decreased performance. ' + error.message.split('\n')[0])
console.warn('Native extraction module not loaded, cbor-x will still run, but with decreased performance. ' + error.message.split('\n')[0])
else
console.warn('For browser usage, directly use msgpackr/unpack or msgpackr/pack modules. ' + error.message.split('\n')[0])
console.warn('For browser usage, directly use cbor-x/decode or cbor-x/encode modules. ' + error.message.split('\n')[0])
}
}
{
"name": "cbor-x",
"author": "Kris Zyp",
"version": "0.8.1",
"version": "0.8.2",
"description": "Ultra-fast CBOR implementation with tag extensions for records and structured cloning",

@@ -22,3 +22,3 @@ "license": "MIT",

"prepare": "npm run build",
"test": "./node_modules/.bin/mocha --experimental-json-modules tests/test.js -u tdd"
"test": "./node_modules/.bin/mocha --experimental-json-modules tests/test**.*js -u tdd"
},

@@ -57,3 +57,3 @@ "type": "module",

"optionalDependencies": {
"cbor-extract": "^0.2.2"
"cbor-extract": "^0.3.0"
},

@@ -60,0 +60,0 @@ "devDependencies": {

@@ -1,9 +0,11 @@

import { PackrStream, UnpackrStream } from '../node.js'
import { EncoderStream, DecoderStream } from '../node.js'
import stream from 'stream'
import chai from 'chai'
var assert = chai.assert
suite('msgpackr node stream tests', function(){
suite('cbor-x node stream tests', function(){
test('serialize/parse stream', () => {
const serializeStream = new PackrStream({
const serializeStream = new EncoderStream({
})
const parseStream = new UnpackrStream()
const parseStream = new DecoderStream()
serializeStream.pipe(parseStream)

@@ -34,3 +36,3 @@ const received = []

test('stream from buffer', () => new Promise(async resolve => {
const parseStream = new UnpackrStream()
const parseStream = new DecoderStream()
let values = []

@@ -37,0 +39,0 @@ parseStream.on('data', (value) => {

Sorry, the diff of this file is not supported yet

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