cbor-x 1.5.4 → 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/decode.js +24 -4
- package/dist/decode-no-eval.cjs +24 -4
- package/dist/decode-no-eval.cjs.map +1 -1
- package/dist/index-no-eval.cjs +24 -4
- package/dist/index-no-eval.cjs.map +1 -1
- package/dist/index-no-eval.min.js +1 -1
- package/dist/index-no-eval.min.js.map +1 -1
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/node.cjs +33 -11
- package/dist/node.cjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/stream.js +9 -7
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cbor-x",
|
|
3
3
|
"author": "Kris Zyp",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.6",
|
|
5
5
|
"description": "Ultra-fast and conformant CBOR (RFC 8949) implementation with support for numerous tag extensions including records and structured cloning",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"types": "./index.d.ts",
|
package/stream.js
CHANGED
|
@@ -13,10 +13,12 @@ export class EncoderStream extends Transform {
|
|
|
13
13
|
this.encoder = options.encoder || new Encoder(options)
|
|
14
14
|
}
|
|
15
15
|
async _transform(value, encoding, callback) {
|
|
16
|
-
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
try {
|
|
17
|
+
for await (let chunk of this.encoder.encodeAsAsyncIterable(value)) {
|
|
18
|
+
this.push(chunk)
|
|
19
|
+
}
|
|
20
|
+
callback()
|
|
21
|
+
} catch(error) { callback (error) }
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -41,9 +43,9 @@ export class DecoderStream extends Transform {
|
|
|
41
43
|
if (error.incomplete) {
|
|
42
44
|
this.incompleteBuffer = chunk.slice(error.lastPosition)
|
|
43
45
|
values = error.values
|
|
46
|
+
} else {
|
|
47
|
+
return callback(error)
|
|
44
48
|
}
|
|
45
|
-
else
|
|
46
|
-
throw error
|
|
47
49
|
} finally {
|
|
48
50
|
for (let value of values || []) {
|
|
49
51
|
if (value === null)
|
|
@@ -51,7 +53,7 @@ export class DecoderStream extends Transform {
|
|
|
51
53
|
this.push(value)
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
|
-
|
|
56
|
+
callback()
|
|
55
57
|
}
|
|
56
58
|
getNullValue() {
|
|
57
59
|
return Symbol.for(null)
|