cborg 1.10.1 → 2.0.0-alpha.1

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.
Files changed (140) hide show
  1. package/.github/dependabot.yml +16 -0
  2. package/.github/workflows/test-and-release.yml +63 -0
  3. package/CHANGELOG.md +332 -0
  4. package/bench/bench.js +117 -0
  5. package/bench/json.js +124 -0
  6. package/bench/package.json +8 -0
  7. package/lib/bin.js +1 -1
  8. package/package.json +29 -47
  9. package/types/lib/4array.d.ts +1 -1
  10. package/types/lib/5map.d.ts +1 -1
  11. package/types/lib/6tag.d.ts +1 -1
  12. package/types/lib/7float.d.ts +1 -1
  13. package/types/lib/bin.d.ts +1 -0
  14. package/types/lib/token.d.ts +13 -13
  15. package/cjs/browser-test/appendix_a.js +0 -643
  16. package/cjs/browser-test/common.js +0 -24
  17. package/cjs/browser-test/node-test-bin.js +0 -348
  18. package/cjs/browser-test/noop-bin-test.js +0 -4
  19. package/cjs/browser-test/test-0uint.js +0 -158
  20. package/cjs/browser-test/test-1negint.js +0 -152
  21. package/cjs/browser-test/test-2bytes.js +0 -254
  22. package/cjs/browser-test/test-3string.js +0 -144
  23. package/cjs/browser-test/test-4array.js +0 -200
  24. package/cjs/browser-test/test-5map.js +0 -667
  25. package/cjs/browser-test/test-6tag.js +0 -75
  26. package/cjs/browser-test/test-7float.js +0 -253
  27. package/cjs/browser-test/test-bl.js +0 -91
  28. package/cjs/browser-test/test-cbor-vectors.js +0 -98
  29. package/cjs/browser-test/test-decode-errors.js +0 -77
  30. package/cjs/browser-test/test-fuzz.js +0 -56
  31. package/cjs/browser-test/test-json.js +0 -281
  32. package/cjs/browser-test/test-length.js +0 -63
  33. package/cjs/cborg.js +0 -14
  34. package/cjs/lib/0uint.js +0 -163
  35. package/cjs/lib/1negint.js +0 -63
  36. package/cjs/lib/2bytes.js +0 -62
  37. package/cjs/lib/3string.js +0 -46
  38. package/cjs/lib/4array.js +0 -51
  39. package/cjs/lib/5map.js +0 -51
  40. package/cjs/lib/6tag.js +0 -36
  41. package/cjs/lib/7float.js +0 -188
  42. package/cjs/lib/bin.js +0 -139
  43. package/cjs/lib/bl.js +0 -77
  44. package/cjs/lib/byte-utils.js +0 -245
  45. package/cjs/lib/common.js +0 -22
  46. package/cjs/lib/decode.js +0 -140
  47. package/cjs/lib/diagnostic.js +0 -124
  48. package/cjs/lib/encode.js +0 -248
  49. package/cjs/lib/is.js +0 -87
  50. package/cjs/lib/json/decode.js +0 -414
  51. package/cjs/lib/json/encode.js +0 -161
  52. package/cjs/lib/json/json.js +0 -12
  53. package/cjs/lib/jump.js +0 -174
  54. package/cjs/lib/length.js +0 -36
  55. package/cjs/lib/token.js +0 -46
  56. package/cjs/node-test/appendix_a.js +0 -643
  57. package/cjs/node-test/common.js +0 -24
  58. package/cjs/node-test/node-test-bin.js +0 -348
  59. package/cjs/node-test/noop-bin-test.js +0 -4
  60. package/cjs/node-test/test-0uint.js +0 -158
  61. package/cjs/node-test/test-1negint.js +0 -152
  62. package/cjs/node-test/test-2bytes.js +0 -254
  63. package/cjs/node-test/test-3string.js +0 -144
  64. package/cjs/node-test/test-4array.js +0 -200
  65. package/cjs/node-test/test-5map.js +0 -667
  66. package/cjs/node-test/test-6tag.js +0 -75
  67. package/cjs/node-test/test-7float.js +0 -253
  68. package/cjs/node-test/test-bl.js +0 -91
  69. package/cjs/node-test/test-cbor-vectors.js +0 -98
  70. package/cjs/node-test/test-decode-errors.js +0 -77
  71. package/cjs/node-test/test-fuzz.js +0 -56
  72. package/cjs/node-test/test-json.js +0 -281
  73. package/cjs/node-test/test-length.js +0 -63
  74. package/cjs/taglib.js +0 -44
  75. package/cli.js +0 -7
  76. package/esm/browser-test/appendix_a.js +0 -640
  77. package/esm/browser-test/common.js +0 -19
  78. package/esm/browser-test/node-test-bin.js +0 -339
  79. package/esm/browser-test/noop-bin-test.js +0 -1
  80. package/esm/browser-test/test-0uint.js +0 -155
  81. package/esm/browser-test/test-1negint.js +0 -149
  82. package/esm/browser-test/test-2bytes.js +0 -252
  83. package/esm/browser-test/test-3string.js +0 -141
  84. package/esm/browser-test/test-4array.js +0 -197
  85. package/esm/browser-test/test-5map.js +0 -664
  86. package/esm/browser-test/test-6tag.js +0 -78
  87. package/esm/browser-test/test-7float.js +0 -250
  88. package/esm/browser-test/test-bl.js +0 -84
  89. package/esm/browser-test/test-cbor-vectors.js +0 -95
  90. package/esm/browser-test/test-decode-errors.js +0 -69
  91. package/esm/browser-test/test-fuzz.js +0 -50
  92. package/esm/browser-test/test-json.js +0 -279
  93. package/esm/browser-test/test-length.js +0 -55
  94. package/esm/cborg.js +0 -12
  95. package/esm/lib/0uint.js +0 -152
  96. package/esm/lib/1negint.js +0 -55
  97. package/esm/lib/2bytes.js +0 -59
  98. package/esm/lib/3string.js +0 -43
  99. package/esm/lib/4array.js +0 -41
  100. package/esm/lib/5map.js +0 -41
  101. package/esm/lib/6tag.js +0 -27
  102. package/esm/lib/7float.js +0 -179
  103. package/esm/lib/bin.js +0 -137
  104. package/esm/lib/bl.js +0 -74
  105. package/esm/lib/byte-utils.js +0 -228
  106. package/esm/lib/common.js +0 -19
  107. package/esm/lib/decode.js +0 -139
  108. package/esm/lib/diagnostic.js +0 -123
  109. package/esm/lib/encode.js +0 -246
  110. package/esm/lib/is.js +0 -81
  111. package/esm/lib/json/decode.js +0 -413
  112. package/esm/lib/json/encode.js +0 -160
  113. package/esm/lib/json/json.js +0 -10
  114. package/esm/lib/jump.js +0 -168
  115. package/esm/lib/length.js +0 -31
  116. package/esm/lib/token.js +0 -43
  117. package/esm/node-test/appendix_a.js +0 -640
  118. package/esm/node-test/common.js +0 -19
  119. package/esm/node-test/node-test-bin.js +0 -339
  120. package/esm/node-test/noop-bin-test.js +0 -1
  121. package/esm/node-test/test-0uint.js +0 -155
  122. package/esm/node-test/test-1negint.js +0 -149
  123. package/esm/node-test/test-2bytes.js +0 -252
  124. package/esm/node-test/test-3string.js +0 -141
  125. package/esm/node-test/test-4array.js +0 -197
  126. package/esm/node-test/test-5map.js +0 -664
  127. package/esm/node-test/test-6tag.js +0 -78
  128. package/esm/node-test/test-7float.js +0 -250
  129. package/esm/node-test/test-bl.js +0 -84
  130. package/esm/node-test/test-cbor-vectors.js +0 -95
  131. package/esm/node-test/test-decode-errors.js +0 -69
  132. package/esm/node-test/test-fuzz.js +0 -50
  133. package/esm/node-test/test-json.js +0 -279
  134. package/esm/node-test/test-length.js +0 -55
  135. package/esm/package.json +0 -4
  136. package/esm/taglib.js +0 -37
  137. package/index.js +0 -1
  138. package/json +0 -1
  139. package/length +0 -1
  140. package/taglib +0 -1
@@ -1,643 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const fixtures = [
6
- {
7
- cbor: 'AA==',
8
- hex: '00',
9
- roundtrip: true,
10
- decoded: 0
11
- },
12
- {
13
- cbor: 'AQ==',
14
- hex: '01',
15
- roundtrip: true,
16
- decoded: 1
17
- },
18
- {
19
- cbor: 'Cg==',
20
- hex: '0a',
21
- roundtrip: true,
22
- decoded: 10
23
- },
24
- {
25
- cbor: 'Fw==',
26
- hex: '17',
27
- roundtrip: true,
28
- decoded: 23
29
- },
30
- {
31
- cbor: 'GBg=',
32
- hex: '1818',
33
- roundtrip: true,
34
- decoded: 24
35
- },
36
- {
37
- cbor: 'GBk=',
38
- hex: '1819',
39
- roundtrip: true,
40
- decoded: 25
41
- },
42
- {
43
- cbor: 'GGQ=',
44
- hex: '1864',
45
- roundtrip: true,
46
- decoded: 100
47
- },
48
- {
49
- cbor: 'GQPo',
50
- hex: '1903e8',
51
- roundtrip: true,
52
- decoded: 1000
53
- },
54
- {
55
- cbor: 'GgAPQkA=',
56
- hex: '1a000f4240',
57
- roundtrip: true,
58
- decoded: 1000000
59
- },
60
- {
61
- cbor: 'GwAAAOjUpRAA',
62
- hex: '1b000000e8d4a51000',
63
- roundtrip: true,
64
- decoded: 1000000000000
65
- },
66
- {
67
- cbor: 'G///////////',
68
- hex: '1bffffffffffffffff',
69
- roundtrip: true,
70
- decoded: BigInt('18446744073709551615')
71
- },
72
- {
73
- cbor: 'wkkBAAAAAAAAAAA=',
74
- hex: 'c249010000000000000000',
75
- roundtrip: true,
76
- decoded: BigInt('18446744073709551616'),
77
- noTagDecodeError: /tag not supported \(2\)/,
78
- noTagEncodeError: /BigInt larger than allowable range/
79
- },
80
- {
81
- cbor: 'O///////////',
82
- hex: '3bffffffffffffffff',
83
- roundtrip: true,
84
- decoded: BigInt('-18446744073709551616')
85
- },
86
- {
87
- cbor: 'w0kBAAAAAAAAAAA=',
88
- hex: 'c349010000000000000000',
89
- roundtrip: true,
90
- decoded: BigInt('-18446744073709551617'),
91
- noTagDecodeError: /tag not supported \(3\)/,
92
- noTagEncodeError: /BigInt larger than allowable range/
93
- },
94
- {
95
- cbor: 'IA==',
96
- hex: '20',
97
- roundtrip: true,
98
- decoded: -1
99
- },
100
- {
101
- cbor: 'KQ==',
102
- hex: '29',
103
- roundtrip: true,
104
- decoded: -10
105
- },
106
- {
107
- cbor: 'OGM=',
108
- hex: '3863',
109
- roundtrip: true,
110
- decoded: -100
111
- },
112
- {
113
- cbor: 'OQPn',
114
- hex: '3903e7',
115
- roundtrip: true,
116
- decoded: -1000
117
- },
118
- {
119
- cbor: '+QAA',
120
- hex: 'f90000',
121
- roundtrip: false,
122
- decoded: 0
123
- },
124
- {
125
- cbor: '+YAA',
126
- hex: 'f98000',
127
- roundtrip: false,
128
- decoded: -0
129
- },
130
- {
131
- cbor: '+TwA',
132
- hex: 'f93c00',
133
- roundtrip: false,
134
- decoded: 1
135
- },
136
- {
137
- cbor: '+z/xmZmZmZma',
138
- hex: 'fb3ff199999999999a',
139
- roundtrip: true,
140
- decoded: 1.1
141
- },
142
- {
143
- cbor: '+T4A',
144
- hex: 'f93e00',
145
- roundtrip: true,
146
- decoded: 1.5
147
- },
148
- {
149
- cbor: '+Xv/',
150
- hex: 'f97bff',
151
- roundtrip: false,
152
- decoded: 65504
153
- },
154
- {
155
- cbor: '+kfDUAA=',
156
- hex: 'fa47c35000',
157
- roundtrip: false,
158
- decoded: 100000
159
- },
160
- {
161
- cbor: '+n9///8=',
162
- hex: 'fa7f7fffff',
163
- roundtrip: true,
164
- decoded: 3.4028234663852886e+38
165
- },
166
- {
167
- cbor: '+3435DyIAHWc',
168
- hex: 'fb7e37e43c8800759c',
169
- roundtrip: true,
170
- decoded: 1e+300
171
- },
172
- {
173
- cbor: '+QAB',
174
- hex: 'f90001',
175
- roundtrip: true,
176
- decoded: 5.960464477539063e-8
177
- },
178
- {
179
- cbor: '+QQA',
180
- hex: 'f90400',
181
- roundtrip: true,
182
- decoded: 0.00006103515625
183
- },
184
- {
185
- cbor: '+cQA',
186
- hex: 'f9c400',
187
- roundtrip: false,
188
- decoded: -4
189
- },
190
- {
191
- cbor: '+8AQZmZmZmZm',
192
- hex: 'fbc010666666666666',
193
- roundtrip: true,
194
- decoded: -4.1
195
- },
196
- {
197
- cbor: '+XwA',
198
- hex: 'f97c00',
199
- roundtrip: true,
200
- diagnostic: Infinity
201
- },
202
- {
203
- cbor: '+X4A',
204
- hex: 'f97e00',
205
- roundtrip: true,
206
- diagnostic: NaN
207
- },
208
- {
209
- cbor: '+fwA',
210
- hex: 'f9fc00',
211
- roundtrip: true,
212
- diagnostic: -Infinity
213
- },
214
- {
215
- cbor: '+n+AAAA=',
216
- hex: 'fa7f800000',
217
- roundtrip: false,
218
- diagnostic: Infinity
219
- },
220
- {
221
- cbor: '+n/AAAA=',
222
- hex: 'fa7fc00000',
223
- roundtrip: false,
224
- diagnostic: NaN
225
- },
226
- {
227
- cbor: '+v+AAAA=',
228
- hex: 'faff800000',
229
- roundtrip: false,
230
- diagnostic: -Infinity
231
- },
232
- {
233
- cbor: '+3/wAAAAAAAA',
234
- hex: 'fb7ff0000000000000',
235
- roundtrip: false,
236
- diagnostic: Infinity
237
- },
238
- {
239
- cbor: '+3/4AAAAAAAA',
240
- hex: 'fb7ff8000000000000',
241
- roundtrip: false,
242
- diagnostic: NaN
243
- },
244
- {
245
- cbor: '+//wAAAAAAAA',
246
- hex: 'fbfff0000000000000',
247
- roundtrip: false,
248
- diagnostic: -Infinity
249
- },
250
- {
251
- cbor: '9A==',
252
- hex: 'f4',
253
- roundtrip: true,
254
- decoded: false
255
- },
256
- {
257
- cbor: '9Q==',
258
- hex: 'f5',
259
- roundtrip: true,
260
- decoded: true
261
- },
262
- {
263
- cbor: '9g==',
264
- hex: 'f6',
265
- roundtrip: true,
266
- decoded: null
267
- },
268
- {
269
- cbor: '9w==',
270
- hex: 'f7',
271
- roundtrip: true,
272
- diagnostic: undefined
273
- },
274
- {
275
- cbor: '8A==',
276
- hex: 'f0',
277
- roundtrip: true,
278
- diagnostic: 'simple(16)',
279
- error: /simple values are not supported/
280
- },
281
- {
282
- cbor: '+Bg=',
283
- hex: 'f818',
284
- roundtrip: true,
285
- diagnostic: 'simple(24)',
286
- error: /simple values are not supported/
287
- },
288
- {
289
- cbor: '+P8=',
290
- hex: 'f8ff',
291
- roundtrip: true,
292
- diagnostic: 'simple(255)',
293
- error: /simple values are not supported/
294
- },
295
- {
296
- cbor: 'wHQyMDEzLTAzLTIxVDIwOjA0OjAwWg==',
297
- hex: 'c074323031332d30332d32315432303a30343a30305a',
298
- roundtrip: false,
299
- diagnostic: '0("2013-03-21T20:04:00Z")'
300
- },
301
- {
302
- cbor: 'wRpRS2ew',
303
- hex: 'c11a514b67b0',
304
- roundtrip: false,
305
- diagnostic: '1(1363896240)'
306
- },
307
- {
308
- cbor: 'wftB1FLZ7CAAAA==',
309
- hex: 'c1fb41d452d9ec200000',
310
- roundtrip: false,
311
- diagnostic: '1(1363896240.5)'
312
- },
313
- {
314
- cbor: '10QBAgME',
315
- hex: 'd74401020304',
316
- roundtrip: false,
317
- diagnostic: '23(h\'01020304\')'
318
- },
319
- {
320
- cbor: '2BhFZElFVEY=',
321
- hex: 'd818456449455446',
322
- roundtrip: false,
323
- diagnostic: '24(h\'6449455446\')'
324
- },
325
- {
326
- cbor: '2CB2aHR0cDovL3d3dy5leGFtcGxlLmNvbQ==',
327
- hex: 'd82076687474703a2f2f7777772e6578616d706c652e636f6d',
328
- roundtrip: false,
329
- diagnostic: '32("http://www.example.com")'
330
- },
331
- {
332
- cbor: 'QA==',
333
- hex: '40',
334
- roundtrip: true,
335
- diagnostic: 'h\'\''
336
- },
337
- {
338
- cbor: 'RAECAwQ=',
339
- hex: '4401020304',
340
- roundtrip: true,
341
- diagnostic: 'h\'01020304\''
342
- },
343
- {
344
- cbor: 'YA==',
345
- hex: '60',
346
- roundtrip: true,
347
- decoded: ''
348
- },
349
- {
350
- cbor: 'YWE=',
351
- hex: '6161',
352
- roundtrip: true,
353
- decoded: 'a'
354
- },
355
- {
356
- cbor: 'ZElFVEY=',
357
- hex: '6449455446',
358
- roundtrip: true,
359
- decoded: 'IETF'
360
- },
361
- {
362
- cbor: 'YiJc',
363
- hex: '62225c',
364
- roundtrip: true,
365
- decoded: '"\\'
366
- },
367
- {
368
- cbor: 'YsO8',
369
- hex: '62c3bc',
370
- roundtrip: true,
371
- decoded: 'ü'
372
- },
373
- {
374
- cbor: 'Y+awtA==',
375
- hex: '63e6b0b4',
376
- roundtrip: true,
377
- decoded: '水'
378
- },
379
- {
380
- cbor: 'ZPCQhZE=',
381
- hex: '64f0908591',
382
- roundtrip: true,
383
- decoded: '\uD800\uDD51'
384
- },
385
- {
386
- cbor: 'gA==',
387
- hex: '80',
388
- roundtrip: true,
389
- decoded: []
390
- },
391
- {
392
- cbor: 'gwECAw==',
393
- hex: '83010203',
394
- roundtrip: true,
395
- decoded: [
396
- 1,
397
- 2,
398
- 3
399
- ]
400
- },
401
- {
402
- cbor: 'gwGCAgOCBAU=',
403
- hex: '8301820203820405',
404
- roundtrip: true,
405
- decoded: [
406
- 1,
407
- [
408
- 2,
409
- 3
410
- ],
411
- [
412
- 4,
413
- 5
414
- ]
415
- ]
416
- },
417
- {
418
- cbor: 'mBkBAgMEBQYHCAkKCwwNDg8QERITFBUWFxgYGBk=',
419
- hex: '98190102030405060708090a0b0c0d0e0f101112131415161718181819',
420
- roundtrip: true,
421
- decoded: [
422
- 1,
423
- 2,
424
- 3,
425
- 4,
426
- 5,
427
- 6,
428
- 7,
429
- 8,
430
- 9,
431
- 10,
432
- 11,
433
- 12,
434
- 13,
435
- 14,
436
- 15,
437
- 16,
438
- 17,
439
- 18,
440
- 19,
441
- 20,
442
- 21,
443
- 22,
444
- 23,
445
- 24,
446
- 25
447
- ]
448
- },
449
- {
450
- cbor: 'oA==',
451
- hex: 'a0',
452
- roundtrip: true,
453
- decoded: {}
454
- },
455
- {
456
- cbor: 'ogECAwQ=',
457
- hex: 'a201020304',
458
- roundtrip: true,
459
- diagnostic: '{1: 2, 3: 4}',
460
- error: /non-string keys not supported/
461
- },
462
- {
463
- cbor: 'omFhAWFiggID',
464
- hex: 'a26161016162820203',
465
- roundtrip: true,
466
- decoded: {
467
- a: 1,
468
- b: [
469
- 2,
470
- 3
471
- ]
472
- }
473
- },
474
- {
475
- cbor: 'gmFhoWFiYWM=',
476
- hex: '826161a161626163',
477
- roundtrip: true,
478
- decoded: [
479
- 'a',
480
- { b: 'c' }
481
- ]
482
- },
483
- {
484
- cbor: 'pWFhYUFhYmFCYWNhQ2FkYURhZWFF',
485
- hex: 'a56161614161626142616361436164614461656145',
486
- roundtrip: true,
487
- decoded: {
488
- a: 'A',
489
- b: 'B',
490
- c: 'C',
491
- d: 'D',
492
- e: 'E'
493
- }
494
- },
495
- {
496
- cbor: 'X0IBAkMDBAX/',
497
- hex: '5f42010243030405ff',
498
- roundtrip: false,
499
- diagnostic: '(_ h\'0102\', h\'030405\')',
500
- error: /indefinite length bytes\/strings are not supported/
501
- },
502
- {
503
- cbor: 'f2VzdHJlYWRtaW5n/w==',
504
- hex: '7f657374726561646d696e67ff',
505
- roundtrip: false,
506
- decoded: 'streaming',
507
- error: /indefinite length bytes\/strings are not supported/
508
- },
509
- {
510
- cbor: 'n/8=',
511
- hex: '9fff',
512
- roundtrip: false,
513
- decoded: []
514
- },
515
- {
516
- cbor: 'nwGCAgOfBAX//w==',
517
- hex: '9f018202039f0405ffff',
518
- roundtrip: false,
519
- decoded: [
520
- 1,
521
- [
522
- 2,
523
- 3
524
- ],
525
- [
526
- 4,
527
- 5
528
- ]
529
- ]
530
- },
531
- {
532
- cbor: 'nwGCAgOCBAX/',
533
- hex: '9f01820203820405ff',
534
- roundtrip: false,
535
- decoded: [
536
- 1,
537
- [
538
- 2,
539
- 3
540
- ],
541
- [
542
- 4,
543
- 5
544
- ]
545
- ]
546
- },
547
- {
548
- cbor: 'gwGCAgOfBAX/',
549
- hex: '83018202039f0405ff',
550
- roundtrip: false,
551
- decoded: [
552
- 1,
553
- [
554
- 2,
555
- 3
556
- ],
557
- [
558
- 4,
559
- 5
560
- ]
561
- ]
562
- },
563
- {
564
- cbor: 'gwGfAgP/ggQF',
565
- hex: '83019f0203ff820405',
566
- roundtrip: false,
567
- decoded: [
568
- 1,
569
- [
570
- 2,
571
- 3
572
- ],
573
- [
574
- 4,
575
- 5
576
- ]
577
- ]
578
- },
579
- {
580
- cbor: 'nwECAwQFBgcICQoLDA0ODxAREhMUFRYXGBgYGf8=',
581
- hex: '9f0102030405060708090a0b0c0d0e0f101112131415161718181819ff',
582
- roundtrip: false,
583
- decoded: [
584
- 1,
585
- 2,
586
- 3,
587
- 4,
588
- 5,
589
- 6,
590
- 7,
591
- 8,
592
- 9,
593
- 10,
594
- 11,
595
- 12,
596
- 13,
597
- 14,
598
- 15,
599
- 16,
600
- 17,
601
- 18,
602
- 19,
603
- 20,
604
- 21,
605
- 22,
606
- 23,
607
- 24,
608
- 25
609
- ]
610
- },
611
- {
612
- cbor: 'v2FhAWFinwID//8=',
613
- hex: 'bf61610161629f0203ffff',
614
- roundtrip: false,
615
- decoded: {
616
- a: 1,
617
- b: [
618
- 2,
619
- 3
620
- ]
621
- }
622
- },
623
- {
624
- cbor: 'gmFhv2FiYWP/',
625
- hex: '826161bf61626163ff',
626
- roundtrip: false,
627
- decoded: [
628
- 'a',
629
- { b: 'c' }
630
- ]
631
- },
632
- {
633
- cbor: 'v2NGdW71Y0FtdCH/',
634
- hex: 'bf6346756ef563416d7421ff',
635
- roundtrip: false,
636
- decoded: {
637
- Fun: true,
638
- Amt: -2
639
- }
640
- }
641
- ];
642
-
643
- exports.fixtures = fixtures;
@@ -1,24 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var token = require('../lib/token.js');
6
-
7
- function dateDecoder(obj) {
8
- if (typeof obj !== 'string') {
9
- throw new Error('expected string for tag 1');
10
- }
11
- return new Date(obj);
12
- }
13
- function dateEncoder(obj) {
14
- if (!(obj instanceof Date)) {
15
- throw new Error('expected Date for "Date" encoder');
16
- }
17
- return [
18
- new token.Token(token.Type.tag, 0),
19
- new token.Token(token.Type.string, obj.toISOString().replace(/\.000Z$/, 'Z'))
20
- ];
21
- }
22
-
23
- exports.dateDecoder = dateDecoder;
24
- exports.dateEncoder = dateEncoder;