Skip to content

Commit cfe8664

Browse files
committed
tweaks
1 parent 7e6801e commit cfe8664

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/encode.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ import { Encoder } from "./Encoder";
33

44
export type EncodeOptions = Partial<
55
Readonly<{
6+
extensionCodec: ExtensionCodecType;
67
maxDepth: number;
78
initialBufferSize: number;
8-
extensionCodec: ExtensionCodecType;
99
}>
1010
>;
1111

12-
export function encode(value: unknown, options?: EncodeOptions): Uint8Array {
13-
const encoder = new Encoder(
14-
options && options.extensionCodec,
15-
options && options.maxDepth,
16-
options && options.initialBufferSize,
17-
);
12+
const defaultEncodeOptions = {};
13+
14+
export function encode(value: unknown, options: EncodeOptions = defaultEncodeOptions): Uint8Array {
15+
const encoder = new Encoder(options.extensionCodec, options.maxDepth, options.initialBufferSize);
1816
encoder.encode(value, 1);
1917
return encoder.getUint8Array();
2018
}

0 commit comments

Comments
 (0)