Skip to content

Commit 3d60fcf

Browse files
committed
fix doc
1 parent eaae3f6 commit 3d60fcf

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ extensionCodec.register({
337337
type: MYTYPE_EXT_TYPE,
338338
encode: (object, context) => {
339339
if (object instanceof MyType) {
340-
context.track(object); // <-- like this
340+
context.track(object);
341341
return encode(object.toJSON(), { extensionCodec, context });
342342
} else {
343343
return null;
@@ -346,7 +346,7 @@ extensionCodec.register({
346346
decode: (data, extType, context) => {
347347
const decoded = decode(data, { extensionCodec, context });
348348
const my = new MyType(decoded);
349-
context.track(my); // <-- and like this
349+
context.track(my);
350350
return my;
351351
},
352352
});
@@ -356,7 +356,7 @@ import { encode, decode } from "@msgpack/msgpack";
356356

357357
const context = new MyContext();
358358

359-
const encoded = = encode({myType: new MyType<any>()}, { extensionCodec, context });
359+
const encoded = encode({ myType: new MyType<any>() }, { extensionCodec, context });
360360
const decoded = decode(encoded, { extensionCodec, context });
361361
```
362362

@@ -376,7 +376,7 @@ So you might want to define a custom codec to handle bigint like this:
376376

377377
```typescript
378378
import { deepStrictEqual } from "assert";
379-
import { encode, decode, ExtensionCodec } from "@msgpack/msgpack";
379+
import { encode, decode, ExtensionCodec, DecodeError } from "@msgpack/msgpack";
380380

381381
// to define a custom codec:
382382
const BIGINT_EXT_TYPE = 0; // Any in 0-127
@@ -405,7 +405,7 @@ extensionCodec.register({
405405

406406
// to use it:
407407
const value = BigInt(Number.MAX_SAFE_INTEGER) + BigInt(1);
408-
const encoded: = encode(value, { extensionCodec });
408+
const encoded = encode(value, { extensionCodec });
409409
deepStrictEqual(decode(encoded, { extensionCodec }), value);
410410
```
411411

src/decode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { SplitUndefined } from "./context.ts";
66
* It decodes a single MessagePack object in a buffer.
77
*
88
* This is a synchronous decoding function.
9-
* See other variants for asynchronous decoding: {@link decodeAsync}, {@link decodeStream}, or {@link decodeArrayStream}.
9+
* See other variants for asynchronous decoding: {@link decodeAsync}, {@link decodeMultiStream}, or {@link decodeArrayStream}.
1010
*
1111
* @throws {@link RangeError} if the buffer is incomplete, including the case where the buffer is empty.
1212
* @throws {@link DecodeError} if the buffer contains invalid data.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy