microcbor 1.0.0 → 1.1.0
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
CHANGED
|
@@ -166,14 +166,16 @@ export class CBOREncoderStream extends TransformStream<CBORValue, Uint8Array> {
|
|
|
166
166
|
|
|
167
167
|
```ts
|
|
168
168
|
/** Decode a single CBOR value. */
|
|
169
|
-
export function decode(data: Uint8Array):
|
|
169
|
+
export function decode<T extends CBORValue = CBORValue>(data: Uint8Array): T
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
#### `decodeIterable`
|
|
173
173
|
|
|
174
174
|
```ts
|
|
175
175
|
/** Decode an iterable of Uint8Array chunks into an iterable of CBOR values */
|
|
176
|
-
export function* decodeIterable
|
|
176
|
+
export function* decodeIterable<T extends CBORValue = CBORValue>(
|
|
177
|
+
source: Iterable<Uint8Array>,
|
|
178
|
+
): IterableIterator<T>
|
|
177
179
|
|
|
178
180
|
```
|
|
179
181
|
|
|
@@ -181,14 +183,16 @@ export function* decodeIterable(source: Iterable<Uint8Array>): IterableIterator<
|
|
|
181
183
|
|
|
182
184
|
```ts
|
|
183
185
|
/** Decode an async iterable of Uint8Array chunks into an async iterable of CBOR values */
|
|
184
|
-
export async function* decodeAsyncIterable
|
|
186
|
+
export async function* decodeAsyncIterable<T extends CBORValue = CBORValue>(
|
|
187
|
+
source: AsyncIterable<Uint8Array>,
|
|
188
|
+
): AsyncIterable<CBORValue>
|
|
185
189
|
```
|
|
186
190
|
|
|
187
191
|
#### `CBORDecoderStream`
|
|
188
192
|
|
|
189
193
|
```ts
|
|
190
194
|
/** Decode a Web Streams API ReadableStream. */
|
|
191
|
-
export class CBORDecoderStream extends TransformStream<Uint8Array,
|
|
195
|
+
export class CBORDecoderStream<T extends CBORValue = CBORValue> extends TransformStream<Uint8Array, T> {
|
|
192
196
|
public constructor()
|
|
193
197
|
}
|
|
194
198
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CBORValue } from "./types.js";
|
|
2
2
|
/** Decode a Web Streams API ReadableStream */
|
|
3
|
-
export declare class CBORDecoderStream extends TransformStream<Uint8Array,
|
|
3
|
+
export declare class CBORDecoderStream<T extends CBORValue = CBORValue> extends TransformStream<Uint8Array, T> {
|
|
4
4
|
constructor();
|
|
5
5
|
}
|
package/lib/Decoder.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CBORValue } from "./types.js";
|
|
2
|
-
export declare class Decoder implements AsyncIterableIterator<
|
|
2
|
+
export declare class Decoder<T extends CBORValue = CBORValue> implements AsyncIterableIterator<T> {
|
|
3
3
|
private offset;
|
|
4
4
|
private byteLength;
|
|
5
5
|
private readonly chunks;
|
|
@@ -29,7 +29,7 @@ export declare class Decoder implements AsyncIterableIterator<CBORValue> {
|
|
|
29
29
|
value: undefined;
|
|
30
30
|
} | {
|
|
31
31
|
done: false;
|
|
32
|
-
value:
|
|
32
|
+
value: T;
|
|
33
33
|
}>;
|
|
34
34
|
private decodeValue;
|
|
35
35
|
}
|
package/lib/decodeIterable.js
CHANGED