cborg 4.4.1 → 4.5.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/CHANGELOG.md +7 -0
- package/README.md +21 -0
- package/bench/README.md +115 -0
- package/bench/bench-comparative.js +133 -0
- package/bench/bench.js +414 -101
- package/bench/fixtures.js +558 -0
- package/bench/index.html +405 -0
- package/cborg.js +2 -1
- package/interface.ts +8 -2
- package/lib/0uint.js +11 -11
- package/lib/1negint.js +4 -4
- package/lib/2bytes.js +5 -5
- package/lib/3string.js +1 -1
- package/lib/4array.js +4 -4
- package/lib/5map.js +4 -4
- package/lib/6tag.js +4 -4
- package/lib/7float.js +10 -10
- package/lib/bl.js +46 -0
- package/lib/encode.js +40 -15
- package/lib/json/encode.js +10 -10
- package/package.json +1 -1
- package/test/test-0uint.js +12 -1
- package/test/test-1negint.js +12 -1
- package/test/test-2bytes.js +11 -1
- package/test/test-3string.js +11 -1
- package/test/test-4array.js +11 -1
- package/test/test-5map.js +11 -3
- package/test/test-6tag.js +19 -1
- package/test/test-7float.js +11 -1
- package/test/test-cbor-vectors.js +13 -2
- package/test/test-encodeInto.js +246 -0
- package/types/cborg.d.ts +2 -1
- package/types/cborg.d.ts.map +1 -1
- package/types/interface.d.ts +7 -2
- package/types/interface.d.ts.map +1 -1
- package/types/lib/0uint.d.ts +6 -6
- package/types/lib/0uint.d.ts.map +1 -1
- package/types/lib/1negint.d.ts +4 -4
- package/types/lib/1negint.d.ts.map +1 -1
- package/types/lib/2bytes.d.ts +3 -3
- package/types/lib/2bytes.d.ts.map +1 -1
- package/types/lib/3string.d.ts +1 -1
- package/types/lib/3string.d.ts.map +1 -1
- package/types/lib/4array.d.ts +3 -3
- package/types/lib/4array.d.ts.map +1 -1
- package/types/lib/5map.d.ts +3 -3
- package/types/lib/5map.d.ts.map +1 -1
- package/types/lib/6tag.d.ts +4 -4
- package/types/lib/6tag.d.ts.map +1 -1
- package/types/lib/7float.d.ts +3 -3
- package/types/lib/7float.d.ts.map +1 -1
- package/types/lib/bl.d.ts +25 -0
- package/types/lib/bl.d.ts.map +1 -1
- package/types/lib/encode.d.ts +12 -1
- package/types/lib/encode.d.ts.map +1 -1
- package/types/lib/json/encode.d.ts +1 -1
- package/types/lib/json/encode.d.ts.map +1 -1
package/types/lib/encode.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type Reference = import("../interface").Reference;
|
|
|
11
11
|
export type StrictTypeEncoder = import("../interface").StrictTypeEncoder;
|
|
12
12
|
export type TokenTypeEncoder = import("../interface").TokenTypeEncoder;
|
|
13
13
|
export type TokenOrNestedTokens = import("../interface").TokenOrNestedTokens;
|
|
14
|
+
export type ByteWriter = import("../interface").ByteWriter;
|
|
14
15
|
/**
|
|
15
16
|
* @param {any} obj
|
|
16
17
|
* @param {EncodeOptions} [options]
|
|
@@ -28,9 +29,19 @@ export function encode(data: any, options?: EncodeOptions): Uint8Array;
|
|
|
28
29
|
* @param {any} data
|
|
29
30
|
* @param {TokenTypeEncoder[]} encoders
|
|
30
31
|
* @param {EncodeOptions} options
|
|
32
|
+
* @param {Uint8Array} [destination]
|
|
31
33
|
* @returns {Uint8Array}
|
|
32
34
|
*/
|
|
33
|
-
export function encodeCustom(data: any, encoders: TokenTypeEncoder[], options: EncodeOptions): Uint8Array;
|
|
35
|
+
export function encodeCustom(data: any, encoders: TokenTypeEncoder[], options: EncodeOptions, destination?: Uint8Array): Uint8Array;
|
|
36
|
+
/**
|
|
37
|
+
* @param {any} data
|
|
38
|
+
* @param {Uint8Array} destination
|
|
39
|
+
* @param {EncodeOptions} [options]
|
|
40
|
+
* @returns {{ written: number }}
|
|
41
|
+
*/
|
|
42
|
+
export function encodeInto(data: any, destination: Uint8Array, options?: EncodeOptions): {
|
|
43
|
+
written: number;
|
|
44
|
+
};
|
|
34
45
|
/** @implements {Reference} */
|
|
35
46
|
export class Ref implements Reference {
|
|
36
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../lib/encode.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../lib/encode.js"],"names":[],"mappings":"AAwCA,oCAAoC;AACpC,oCADc,gBAAgB,EAAE,CAY/B;AAnBD,4BAA4B;AAC5B,mCADW,aAAa,CAKtB;sBA+XW,KAAK,GAAG;IAAE,SAAS,CAAC,EAAE,UAAU,CAAA;CAAE;4BApZlC,OAAO,cAAc,EAAE,aAAa;kCACpC,OAAO,cAAc,EAAE,mBAAmB;wBAC1C,OAAO,cAAc,EAAE,SAAS;gCAChC,OAAO,cAAc,EAAE,iBAAiB;+BACxC,OAAO,cAAc,EAAE,gBAAgB;kCACvC,OAAO,cAAc,EAAE,mBAAmB;yBAC1C,OAAO,cAAc,EAAE,UAAU;AA0R9C;;;;;GAKG;AACH,oCALW,GAAG,YACH,aAAa,aACb,SAAS,GACP,mBAAmB,CAgB/B;AA4LD;;;;GAIG;AACH,6BAJW,GAAG,YACH,aAAa,GACX,UAAU,CAKtB;AAnDD;;;;;;GAMG;AACH,mCANW,GAAG,YACH,gBAAgB,EAAE,WAClB,aAAa,gBACb,UAAU,GACR,UAAU,CAoCtB;AAYD;;;;;GAKG;AACH,iCALW,GAAG,eACH,UAAU,YACV,aAAa,GACX;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAM/B;AA3dD,8BAA8B;AAC9B,4BADiB,SAAS;IA0BxB;;;;OAIG;IACH,0BAJW,SAAS,GAAC,SAAS,OACnB,MAAM,GAAC,GAAG,EAAE,GACV,SAAS,CAOrB;IAlCD;;;OAGG;IACH,iBAHW,MAAM,GAAC,GAAG,EAAE,UACZ,SAAS,GAAC,SAAS,EAK7B;IAFC,oBAAc;IACd,qDAAoB;IAGtB;;;OAGG;IACH,cAHW,MAAM,GAAC,GAAG,EAAE,GACV,OAAO,CAWnB;CAaF;sBA9F2B,YAAY"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type EncodeOptions = import("../../interface").EncodeOptions;
|
|
2
|
+
export type ByteWriter = import("../../interface").ByteWriter;
|
|
2
3
|
export type Token = import("../token").Token;
|
|
3
|
-
export type Bl = import("../bl").Bl;
|
|
4
4
|
/**
|
|
5
5
|
* @param {any} data
|
|
6
6
|
* @param {EncodeOptions} [options]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../lib/json/encode.js"],"names":[],"mappings":"4BAMa,OAAO,iBAAiB,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../lib/json/encode.js"],"names":[],"mappings":"4BAMa,OAAO,iBAAiB,EAAE,aAAa;yBACvC,OAAO,iBAAiB,EAAE,UAAU;oBACpC,OAAO,UAAU,EAAE,KAAK;AAoSrC;;;;GAIG;AACH,6BAJW,GAAG,YACH,aAAa,GACX,UAAU,CAMtB"}
|