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