Comparing version 1.8.0 to 1.8.1
@@ -1,3 +0,3 @@ | ||
declare const version = "1.8.0"; | ||
declare const version = "1.8.1"; | ||
export { version }; |
@@ -1,1 +0,1 @@ | ||
const o="1.8.0";export{o as version}; | ||
const o="1.8.1";export{o as version}; |
{ | ||
"name": "cbor2", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC8949).", | ||
@@ -5,0 +5,0 @@ "exports": { |
@@ -38,3 +38,3 @@ # cbor2 | ||
```js | ||
import {decode, diagnose, encode} from 'cbor'; | ||
import {decode, diagnose, encode} from 'cbor2'; | ||
@@ -163,10 +163,11 @@ const encoded = encode(true); // Returns Uint8Array(1) [ 245 ] | ||
```js | ||
import {Buffer} from 'node:buffer'; | ||
import {registerEncoder} from 'cbor2/encoder'; | ||
class Bar { | ||
constructor() { | ||
this.three = 3; | ||
} | ||
} | ||
registerEncoder(Bar, (b, _writer, _options) => [NaN, b.three]); | ||
registerEncoder(Buffer, b => [ | ||
// Don't write a tag | ||
NaN, | ||
// New view on the ArrayBuffer, without copying bytes | ||
new Uint8Array(b.buffer, b.byteOffset, b.byteLength), | ||
]); | ||
``` | ||
@@ -173,0 +174,0 @@ |
89810
246