json-as 0.9.26 → 0.9.28

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
@@ -1,19 +1,22 @@
1
1
  <h5 align="center">
2
- <pre> __ _____ _____ _____ _____ _____
3
- __| || __|| || | | ___ | _ || __|
4
- | | ||__ || | || | | ||___|| ||__ |
5
- |_____||_____||_____||_|___| |__|__||_____|
6
- v0.9.26
7
- </pre>
2
+ <pre>
3
+ <span style="font-size: 0.8em;"> ██ ███████ ██████ ███ ██ █████ ███████
4
+ ██ ██ ██ ██ ████ ██ ██ ██ ██
5
+ ██ ███████ ██ ██ ██ ██ ██ █████ ███████ ███████
6
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
7
+ █████ ███████ ██████ ██ ████ ██ ██ ███████
8
+ </span>
9
+ AssemblyScript - v0.9.28
10
+ </pre>
8
11
  </h5>
9
12
 
10
13
  ## Installation
11
14
 
12
15
  ```bash
13
- npm install json-as
16
+ npm install json-as visitor-as
14
17
  ```
15
18
 
16
- Add the transform to your `asc` command (e.g. in package.json)
19
+ Add the `--transform` to your `asc` command (e.g. in package.json)
17
20
 
18
21
  ```bash
19
22
  --transform json-as/transform
@@ -21,7 +24,7 @@ Add the transform to your `asc` command (e.g. in package.json)
21
24
 
22
25
  Alternatively, add it to your `asconfig.json`
23
26
 
24
- ```
27
+ ```json
25
28
  {
26
29
  // ...
27
30
  "options": {
@@ -107,69 +110,13 @@ const serialized = JSON.stringify(arr);
107
110
  const parsed = JSON.parse<Base[]>(serialized);
108
111
  ```
109
112
 
110
- You can also add it to your `asconfig.json`
111
-
112
- ```json
113
- {
114
- // ...
115
- "options": {
116
- "transform": ["json-as/transform"]
117
- }
118
- }
119
- ```
120
-
121
113
  If you use this project in your codebase, consider dropping a [star](https://github.com/JairusSW/as-json). I would really appreciate it!
122
114
 
123
- ## Notes
124
-
125
- If you want a feature, drop an issue (and again, maybe a star). I'll likely add it in less than 7 days.
126
-
127
115
  ## Contact
128
116
 
129
- Contact me at:
130
-
131
- Email: `me@jairus.dev`
132
- GitHub: `JairusSW`
133
- Discord: `jairussw`
134
-
135
- ## Performance
136
-
137
- Run or view the benchmarks [here](https://github.com/JairusSW/as-json/tree/master/bench)
138
-
139
- Below are benchmark results comparing JavaScript's built-in JSON implementation and `JSON-AS`
140
-
141
- My library beats JSON (written in C++) on all counts _and_, I see many places where I can pull at least a 60% uplift in performance if I implement it.
142
-
143
- Note: SIMD is in-development and only available on the `v1` branch on GitHub
144
-
145
- Serialization Benchmarks:
146
-
147
- | Value | JavaScript (ops/s) | JSON-AS (ops/s) | JSON-AS (Pages) | JSON-AS (SIMD+Pages) | Max Throughput |
148
- | -------------------------- | ------------------ | ------------------ | ------------------- | -------------------- | -------------- |
149
- | "hello world" | 7,124,361 | 44,290,480 (6.2x) | 73,601,235 (10.3x) | NOT IMPLEMENTED | 1.91 GB/s |
150
- | 12345 | 9,611,677 | 66,900,642 (6.9x) | 145,924,333 (15.2x) | NOT IMPLEMENTED | 0.58 GB/s |
151
- | 1.2345 | 7,227,259 | 20,322,939 (2.8x) | NOT IMPLEMENTED | NOT IMPLEMENTED | 0.16 GB/s |
152
- | [[],[[]],[[],[[]]]] | 5,655,429 | 34,453,102 (6.0x) | NOT IMPLEMENTED | NOT IMPLEMENTED | 1.32 GB/s |
153
- | { x: f64, y: f64, z: f64 } | 3,878,604 | 44,557,996 (11.5x) | 113,203,242 (29.2x) | 172,023,231 (44.4x) | 8.61 GB/s |
154
-
155
- Deserialization Benchmarks:
156
-
157
- | Value | JavaScript (ops/s) | JSON-AS (ops/s) | Difference |
158
- | -------------------------- | ------------------ | --------------- | ---------- |
159
- | "hello world" | 12,210,131 | 24,274,496 | + 98% |
160
- | "12345" | 21,376,873 | 254,640,930 | + 1,191% |
161
- | 1.2345 | 23,193,902 | 221,869,840 | + 987% |
162
- | [[],[[]],[[],[[]]]] | 4,777,227 | 74,921,123 | + 1,568% |
163
- | { x: f64, y: f64, z: f64 } | 10,973,723 | 25,214,019 | + 230% |
164
-
165
- And my PC specs:
166
-
167
- | Component | Specification |
168
- | -------------- | ------------------------------ |
169
- | Wasmer Version | v4.3.0 |
170
- | CPU | AMD Ryzen 7 7800x3D @ 6.00 GHz |
171
- | Memory | T-Force DDR5 6000 MHz |
172
- | OS | Ubuntu WSL2 |
117
+ - [Email](mailto:me@jairus.dev)
118
+ - [GitHub](https://github.com/JairusSW)
119
+ - [Discord](discord.com/users/600700584038760448)
173
120
 
174
121
  ## Issues
175
122
 
package/assembly/index.ts CHANGED
@@ -3,7 +3,7 @@ import { serializeString } from "./serialize/string";
3
3
  import { serializeBool } from "./serialize/bool";
4
4
  import { serializeInteger } from "./serialize/integer";
5
5
  import { serializeFloat } from "./serialize/float";
6
- import { serializeObject, serializeObject_Pretty } from "./serialize/object";
6
+ import { serializeObject } from "./serialize/object";
7
7
  import { serializeDate } from "./serialize/date";
8
8
  import { serializeArray } from "./serialize/array";
9
9
  import { serializeMap } from "./serialize/map";
@@ -13,19 +13,12 @@ import { deserializeFloat } from "./deserialize/float";
13
13
  import { deserializeObject, deserializeObject_Safe } from "./deserialize/object";
14
14
  import { deserializeMap, deserializeMap_Safe } from "./deserialize/map";
15
15
  import { deserializeDate } from "./deserialize/date";
16
- import { BRACE_LEFT, BRACKET_LEFT, CHAR_F, CHAR_N, CHAR_T, NULL_WORD, QUOTE } from "./custom/chars";
16
+ import { NULL_WORD } from "./custom/chars";
17
17
  import { deserializeInteger, deserializeInteger_Safe } from "./deserialize/integer";
18
18
  import { deserializeString, deserializeString_Safe } from "./deserialize/string";
19
19
  import { Sink } from "./custom/sink";
20
20
  import { getArrayDepth } from "./custom/util";
21
21
 
22
- // Config
23
- class SerializeOptions {
24
- public pretty: bool = false;
25
- }
26
-
27
- const DEFAULT_SERIALIZE_OPTIONS = new SerializeOptions();
28
-
29
22
  /**
30
23
  * Offset of the 'storage' property in the JSON.Value class.
31
24
  */
@@ -173,10 +166,11 @@ export namespace JSON {
173
166
  * @param data T
174
167
  * @returns string
175
168
  */
176
- // @ts-ignore: Decorator
177
- @inline export function stringify<T>(data: T/*, options: SerializeOptions = DEFAULT_SERIALIZE_OPTIONS*/): string {
169
+ export function stringify<T>(data: T/*, options: SerializeOptions = DEFAULT_SERIALIZE_OPTIONS*/): string {
178
170
  if (isBoolean<T>()) {
179
171
  return serializeBool(data as bool);
172
+ } else if (isInteger<T>() && nameof<T>() == "usize" && data == 0) {
173
+ return NULL_WORD;
180
174
  } else if (isInteger<T>()) {
181
175
  // @ts-ignore
182
176
  return serializeInteger<T>(data);
@@ -220,9 +214,7 @@ export namespace JSON {
220
214
  * @param data string
221
215
  * @returns T
222
216
  */
223
-
224
- // @ts-ignore: Decorator
225
- @inline export function parse<T>(data: string): T {
217
+ export function parse<T>(data: string): T {
226
218
  if (isBoolean<T>()) {
227
219
  return deserializeBoolean(data) as T;
228
220
  } else if (isInteger<T>()) {
@@ -0,0 +1,1049 @@
1
+ [
2
+ [
3
+ {
4
+ "file": "test.spec.ts",
5
+ "order": 1,
6
+ "time": {
7
+ "start": 2.422076,
8
+ "end": 2.505775
9
+ },
10
+ "description": "Should serialize class inheritance",
11
+ "depth": 0,
12
+ "suites": [],
13
+ "tests": [
14
+ {
15
+ "verdict": "ok",
16
+ "_left": "{\"a\":\"1\",\"b\":\"2\"}",
17
+ "_right": 5424,
18
+ "_not": false
19
+ }
20
+ ],
21
+ "logs": [],
22
+ "kind": "describe",
23
+ "verdict": "ok"
24
+ },
25
+ {
26
+ "file": "test.spec.ts",
27
+ "order": 1,
28
+ "time": {
29
+ "start": 2.527318,
30
+ "end": 2.537277
31
+ },
32
+ "description": "Should serialize nulls",
33
+ "depth": 0,
34
+ "suites": [],
35
+ "tests": [
36
+ {
37
+ "verdict": "ok",
38
+ "_left": "null",
39
+ "_right": 2032,
40
+ "_not": false
41
+ }
42
+ ],
43
+ "logs": [],
44
+ "kind": "describe",
45
+ "verdict": "ok"
46
+ },
47
+ {
48
+ "file": "test.spec.ts",
49
+ "order": 4,
50
+ "time": {
51
+ "start": 2.551104,
52
+ "end": 2.6646
53
+ },
54
+ "description": "Should serialize integer arrays",
55
+ "depth": 0,
56
+ "suites": [],
57
+ "tests": [
58
+ {
59
+ "verdict": "ok",
60
+ "_left": "[0,100,101]",
61
+ "_right": 6544,
62
+ "_not": false
63
+ },
64
+ {
65
+ "verdict": "ok",
66
+ "_left": "[0,100,101]",
67
+ "_right": 6544,
68
+ "_not": false
69
+ },
70
+ {
71
+ "verdict": "ok",
72
+ "_left": "[0,100,101,-100,-101]",
73
+ "_right": 6688,
74
+ "_not": false
75
+ },
76
+ {
77
+ "verdict": "ok",
78
+ "_left": "[0,100,101,-100,-101]",
79
+ "_right": 6688,
80
+ "_not": false
81
+ }
82
+ ],
83
+ "logs": [],
84
+ "kind": "describe",
85
+ "verdict": "ok"
86
+ },
87
+ {
88
+ "file": "test.spec.ts",
89
+ "order": 2,
90
+ "time": {
91
+ "start": 2.781211,
92
+ "end": 3.01479
93
+ },
94
+ "description": "Should serialize float arrays",
95
+ "depth": 0,
96
+ "suites": [],
97
+ "tests": [
98
+ {
99
+ "verdict": "ok",
100
+ "_left": "[7.23,1000.0,1000.0,1.23456,1.23456,0.0,7.23]",
101
+ "_right": 8144,
102
+ "_not": false
103
+ },
104
+ {
105
+ "verdict": "ok",
106
+ "_left": "[1e+21,1e+22,1e-7,1e-8,1e-9]",
107
+ "_right": 8320,
108
+ "_not": false
109
+ }
110
+ ],
111
+ "logs": [],
112
+ "kind": "describe",
113
+ "verdict": "ok"
114
+ },
115
+ {
116
+ "file": "test.spec.ts",
117
+ "order": 2,
118
+ "time": {
119
+ "start": 3.171788,
120
+ "end": 3.363089
121
+ },
122
+ "description": "Should serialize boolean arrays",
123
+ "depth": 0,
124
+ "suites": [],
125
+ "tests": [
126
+ {
127
+ "verdict": "ok",
128
+ "_left": "[true,false]",
129
+ "_right": 8560,
130
+ "_not": false
131
+ },
132
+ {
133
+ "verdict": "ok",
134
+ "_left": "[true,false]",
135
+ "_right": 8560,
136
+ "_not": false
137
+ }
138
+ ],
139
+ "logs": [],
140
+ "kind": "describe",
141
+ "verdict": "ok"
142
+ },
143
+ {
144
+ "file": "test.spec.ts",
145
+ "order": 1,
146
+ "time": {
147
+ "start": 3.453728,
148
+ "end": 3.489774
149
+ },
150
+ "description": "Should serialize string arrays",
151
+ "depth": 0,
152
+ "suites": [],
153
+ "tests": [
154
+ {
155
+ "verdict": "ok",
156
+ "_left": "[\"string \\\"with random spa\\nces and \\nnewlines\\n\\n\\n\"]",
157
+ "_right": 8896,
158
+ "_not": false
159
+ }
160
+ ],
161
+ "logs": [],
162
+ "kind": "describe",
163
+ "verdict": "ok"
164
+ },
165
+ {
166
+ "file": "test.spec.ts",
167
+ "order": 1,
168
+ "time": {
169
+ "start": 3.525718,
170
+ "end": 3.560356
171
+ },
172
+ "description": "Should serialize nested integer arrays",
173
+ "depth": 0,
174
+ "suites": [],
175
+ "tests": [
176
+ {
177
+ "verdict": "ok",
178
+ "_left": "[[100,101],[-100,-101],[0]]",
179
+ "_right": 9280,
180
+ "_not": false
181
+ }
182
+ ],
183
+ "logs": [],
184
+ "kind": "describe",
185
+ "verdict": "ok"
186
+ },
187
+ {
188
+ "file": "test.spec.ts",
189
+ "order": 1,
190
+ "time": {
191
+ "start": 3.590926,
192
+ "end": 3.649408
193
+ },
194
+ "description": "Should serialize nested float arrays",
195
+ "depth": 0,
196
+ "suites": [],
197
+ "tests": [
198
+ {
199
+ "verdict": "ok",
200
+ "_left": "[[7.23],[1000.0],[1000.0],[1.23456],[1.23456],[0.0],[7.23]]",
201
+ "_right": 9712,
202
+ "_not": false
203
+ }
204
+ ],
205
+ "logs": [],
206
+ "kind": "describe",
207
+ "verdict": "ok"
208
+ },
209
+ {
210
+ "file": "test.spec.ts",
211
+ "order": 2,
212
+ "time": {
213
+ "start": 3.683391,
214
+ "end": 4.305789
215
+ },
216
+ "description": "Should serialize nested boolean arrays",
217
+ "depth": 0,
218
+ "suites": [],
219
+ "tests": [
220
+ {
221
+ "verdict": "ok",
222
+ "_left": "[[true],[false]]",
223
+ "_right": 10048,
224
+ "_not": false
225
+ },
226
+ {
227
+ "verdict": "ok",
228
+ "_left": "[[true],[false]]",
229
+ "_right": 10048,
230
+ "_not": false
231
+ }
232
+ ],
233
+ "logs": [],
234
+ "kind": "describe",
235
+ "verdict": "ok"
236
+ },
237
+ {
238
+ "file": "test.spec.ts",
239
+ "order": 1,
240
+ "time": {
241
+ "start": 4.457726,
242
+ "end": 4.523956
243
+ },
244
+ "description": "Should serialize object arrays",
245
+ "depth": 0,
246
+ "suites": [],
247
+ "tests": [
248
+ {
249
+ "verdict": "ok",
250
+ "_left": "[{\"x\":3.4,\"y\":1.2,\"z\":8.3},{\"x\":3.4,\"y\":-2.1,\"z\":9.3}]",
251
+ "_right": 10432,
252
+ "_not": false
253
+ }
254
+ ],
255
+ "logs": [],
256
+ "kind": "describe",
257
+ "verdict": "ok"
258
+ },
259
+ {
260
+ "file": "test.spec.ts",
261
+ "order": 8,
262
+ "time": {
263
+ "start": 4.587136,
264
+ "end": 4.67263
265
+ },
266
+ "description": "Should serialize objects",
267
+ "depth": 0,
268
+ "suites": [],
269
+ "tests": [
270
+ {
271
+ "verdict": "ok",
272
+ "_left": "{\"x\":3.4,\"y\":1.2,\"z\":8.3}",
273
+ "_right": 10672,
274
+ "_not": false
275
+ },
276
+ {
277
+ "verdict": "ok",
278
+ "_left": "{\"firstName\":\"Emmet\",\"lastName\":\"West\",\"lastActive\":[8,27,2022],\"age\":23,\"pos\":{\"x\":3.4,\"y\":1.2,\"z\":8.3},\"isVerified\":true}",
279
+ "_right": 11216,
280
+ "_not": false
281
+ },
282
+ {
283
+ "verdict": "ok",
284
+ "_left": "{\"f\":7.23}",
285
+ "_right": 11552,
286
+ "_not": false
287
+ },
288
+ {
289
+ "verdict": "ok",
290
+ "_left": "{\"f\":0.000001}",
291
+ "_right": 11600,
292
+ "_not": false
293
+ },
294
+ {
295
+ "verdict": "ok",
296
+ "_left": "{\"f\":1e-7}",
297
+ "_right": 11648,
298
+ "_not": false
299
+ },
300
+ {
301
+ "verdict": "ok",
302
+ "_left": "{\"f\":100000000000000000000.0}",
303
+ "_right": 11696,
304
+ "_not": false
305
+ },
306
+ {
307
+ "verdict": "ok",
308
+ "_left": "{\"f\":1e+21}",
309
+ "_right": 11776,
310
+ "_not": false
311
+ },
312
+ {
313
+ "verdict": "ok",
314
+ "_left": "{\"a\\\\\\t\\\"\\u0002b`c\":\"foo\"}",
315
+ "_right": 11952,
316
+ "_not": false
317
+ }
318
+ ],
319
+ "logs": [],
320
+ "kind": "describe",
321
+ "verdict": "ok"
322
+ },
323
+ {
324
+ "file": "test.spec.ts",
325
+ "order": 1,
326
+ "time": {
327
+ "start": 4.921727,
328
+ "end": 4.987323
329
+ },
330
+ "description": "Should serialize @omit'ed objects",
331
+ "depth": 0,
332
+ "suites": [],
333
+ "tests": [
334
+ {
335
+ "verdict": "ok",
336
+ "_left": "{\"x\":1,\"y\":1,\"z\":1}",
337
+ "_right": 12320,
338
+ "_not": false
339
+ }
340
+ ],
341
+ "logs": [],
342
+ "kind": "describe",
343
+ "verdict": "ok"
344
+ },
345
+ {
346
+ "file": "test.spec.ts",
347
+ "order": 3,
348
+ "time": {
349
+ "start": 5.027487,
350
+ "end": 5.064593
351
+ },
352
+ "description": "Should deserialize class inheritance",
353
+ "depth": 0,
354
+ "suites": [],
355
+ "tests": [
356
+ {
357
+ "verdict": "ok",
358
+ "_left": true,
359
+ "_right": 1,
360
+ "_not": false
361
+ },
362
+ {
363
+ "verdict": "ok",
364
+ "_left": "1",
365
+ "_right": 2864,
366
+ "_not": false
367
+ },
368
+ {
369
+ "verdict": "ok",
370
+ "_left": "2",
371
+ "_right": 2896,
372
+ "_not": false
373
+ }
374
+ ],
375
+ "logs": [],
376
+ "kind": "describe",
377
+ "verdict": "ok"
378
+ },
379
+ {
380
+ "file": "test.spec.ts",
381
+ "order": 1,
382
+ "time": {
383
+ "start": 5.098623,
384
+ "end": 5.117553
385
+ },
386
+ "description": "Should deserialize nulls",
387
+ "depth": 0,
388
+ "suites": [],
389
+ "tests": [
390
+ {
391
+ "verdict": "ok",
392
+ "_left": "null",
393
+ "_right": 2032,
394
+ "_not": false
395
+ }
396
+ ],
397
+ "logs": [],
398
+ "kind": "describe",
399
+ "verdict": "ok"
400
+ },
401
+ {
402
+ "file": "test.spec.ts",
403
+ "order": 2,
404
+ "time": {
405
+ "start": 5.173811,
406
+ "end": 5.35768
407
+ },
408
+ "description": "Should deserialize integer arrays",
409
+ "depth": 0,
410
+ "suites": [],
411
+ "tests": [
412
+ {
413
+ "verdict": "ok",
414
+ "_left": "[0,100,101]",
415
+ "_right": 69360,
416
+ "_not": false
417
+ },
418
+ {
419
+ "verdict": "ok",
420
+ "_left": "[0,100,101,-100,-101]",
421
+ "_right": 69888,
422
+ "_not": false
423
+ }
424
+ ],
425
+ "logs": [],
426
+ "kind": "describe",
427
+ "verdict": "ok"
428
+ },
429
+ {
430
+ "file": "test.spec.ts",
431
+ "order": 2,
432
+ "time": {
433
+ "start": 5.38901,
434
+ "end": 5.443273
435
+ },
436
+ "description": "Should deserialize float arrays",
437
+ "depth": 0,
438
+ "suites": [],
439
+ "tests": [
440
+ {
441
+ "verdict": "ok",
442
+ "_left": "[7.23,1000.0,1000.0,1.23456,1.23456,0.0,7.23]",
443
+ "_right": 85568,
444
+ "_not": false
445
+ },
446
+ {
447
+ "verdict": "ok",
448
+ "_left": "[1e+21,1e+22,1e-7,1e-8,1e-9]",
449
+ "_right": 71472,
450
+ "_not": false
451
+ }
452
+ ],
453
+ "logs": [],
454
+ "kind": "describe",
455
+ "verdict": "ok"
456
+ },
457
+ {
458
+ "file": "test.spec.ts",
459
+ "order": 1,
460
+ "time": {
461
+ "start": 5.472564,
462
+ "end": 5.499495
463
+ },
464
+ "description": "Should deserialize boolean arrays",
465
+ "depth": 0,
466
+ "suites": [],
467
+ "tests": [
468
+ {
469
+ "verdict": "ok",
470
+ "_left": "[true,false]",
471
+ "_right": 84304,
472
+ "_not": false
473
+ }
474
+ ],
475
+ "logs": [],
476
+ "kind": "describe",
477
+ "verdict": "ok"
478
+ },
479
+ {
480
+ "file": "test.spec.ts",
481
+ "order": 1,
482
+ "time": {
483
+ "start": 5.533943,
484
+ "end": 5.574916
485
+ },
486
+ "description": "Should deserialize string arrays",
487
+ "depth": 0,
488
+ "suites": [],
489
+ "tests": [
490
+ {
491
+ "verdict": "ok",
492
+ "_left": "[\"string \\\"with random spa\\nces and \\nnewlines\\n\\n\\n\"]",
493
+ "_right": 81008,
494
+ "_not": false
495
+ }
496
+ ],
497
+ "logs": [],
498
+ "kind": "describe",
499
+ "verdict": "ok"
500
+ },
501
+ {
502
+ "file": "test.spec.ts",
503
+ "order": 1,
504
+ "time": {
505
+ "start": 5.604141,
506
+ "end": 5.778483
507
+ },
508
+ "description": "Should deserialize nested integer arrays",
509
+ "depth": 0,
510
+ "suites": [],
511
+ "tests": [
512
+ {
513
+ "verdict": "ok",
514
+ "_left": "[[100,101],[-100,-101],[0]]",
515
+ "_right": 74912,
516
+ "_not": false
517
+ }
518
+ ],
519
+ "logs": [],
520
+ "kind": "describe",
521
+ "verdict": "ok"
522
+ },
523
+ {
524
+ "file": "test.spec.ts",
525
+ "order": 1,
526
+ "time": {
527
+ "start": 5.814182,
528
+ "end": 5.895128
529
+ },
530
+ "description": "Should deserialize nested float arrays",
531
+ "depth": 0,
532
+ "suites": [],
533
+ "tests": [
534
+ {
535
+ "verdict": "ok",
536
+ "_left": "[[7.23],[1000.0],[1000.0],[1.23456],[1.23456],[0.0],[7.23]]",
537
+ "_right": 89264,
538
+ "_not": false
539
+ }
540
+ ],
541
+ "logs": [],
542
+ "kind": "describe",
543
+ "verdict": "ok"
544
+ },
545
+ {
546
+ "file": "test.spec.ts",
547
+ "order": 1,
548
+ "time": {
549
+ "start": 5.928267,
550
+ "end": 5.966731
551
+ },
552
+ "description": "Should deserialize nested boolean arrays",
553
+ "depth": 0,
554
+ "suites": [],
555
+ "tests": [
556
+ {
557
+ "verdict": "ok",
558
+ "_left": "[[true],[false]]",
559
+ "_right": 76352,
560
+ "_not": false
561
+ }
562
+ ],
563
+ "logs": [],
564
+ "kind": "describe",
565
+ "verdict": "ok"
566
+ },
567
+ {
568
+ "file": "test.spec.ts",
569
+ "order": 1,
570
+ "time": {
571
+ "start": 5.997331,
572
+ "end": 6.053426
573
+ },
574
+ "description": "Should deserialize object arrays",
575
+ "depth": 0,
576
+ "suites": [],
577
+ "tests": [
578
+ {
579
+ "verdict": "ok",
580
+ "_left": "[{\"x\":3.4,\"y\":1.2,\"z\":8.3},{\"x\":3.4,\"y\":-2.1,\"z\":9.3}]",
581
+ "_right": 79024,
582
+ "_not": false
583
+ }
584
+ ],
585
+ "logs": [],
586
+ "kind": "describe",
587
+ "verdict": "ok"
588
+ },
589
+ {
590
+ "file": "test.spec.ts",
591
+ "order": 5,
592
+ "time": {
593
+ "start": 6.087986,
594
+ "end": 6.532848
595
+ },
596
+ "description": "Should deserialize Objects",
597
+ "depth": 0,
598
+ "suites": [],
599
+ "tests": [
600
+ {
601
+ "verdict": "ok",
602
+ "_left": "{\"x\":3.4,\"y\":1.2,\"z\":8.3}",
603
+ "_right": 92000,
604
+ "_not": false
605
+ },
606
+ {
607
+ "verdict": "ok",
608
+ "_left": "{\"firstName\":\"Emmet\",\"lastName\":\"West\",\"lastActive\":[8,27,2022],\"age\":23,\"pos\":{\"x\":3.4,\"y\":1.2,\"z\":8.3},\"isVerified\":true}",
609
+ "_right": 80720,
610
+ "_not": false
611
+ },
612
+ {
613
+ "verdict": "ok",
614
+ "_left": "{\"f\":7.23}",
615
+ "_right": 69312,
616
+ "_not": false
617
+ },
618
+ {
619
+ "verdict": "ok",
620
+ "_left": "{\"f\":0.000001}",
621
+ "_right": 80000,
622
+ "_not": false
623
+ },
624
+ {
625
+ "verdict": "ok",
626
+ "_left": "{\"a\\\\\\t\\\"\\u0002b`c\":\"foo\"}",
627
+ "_right": 91264,
628
+ "_not": false
629
+ }
630
+ ],
631
+ "logs": [],
632
+ "kind": "describe",
633
+ "verdict": "ok"
634
+ }
635
+ ],
636
+ [
637
+ {
638
+ "file": "string.spec.ts",
639
+ "order": 4,
640
+ "time": {
641
+ "start": 2.224829,
642
+ "end": 2.270118
643
+ },
644
+ "description": "Should serialize strings",
645
+ "depth": 0,
646
+ "suites": [],
647
+ "tests": [
648
+ {
649
+ "verdict": "ok",
650
+ "_left": "\"abcdefg\"",
651
+ "_right": 4016,
652
+ "_not": false
653
+ },
654
+ {
655
+ "verdict": "ok",
656
+ "_left": "\"st\\\"ring\\\" w\\\"\\\"ith quotes\\\"\"",
657
+ "_right": 4240,
658
+ "_not": false
659
+ },
660
+ {
661
+ "verdict": "ok",
662
+ "_left": "\"string \\\"with random spa\\nces and \\nnewlines\\n\\n\\n\"",
663
+ "_right": 4432,
664
+ "_not": false
665
+ },
666
+ {
667
+ "verdict": "ok",
668
+ "_left": "\"string with colon : comma , brace [ ] bracket { } and quote \\\" and other quote \\\\\\\"\"",
669
+ "_right": 4752,
670
+ "_not": false
671
+ }
672
+ ],
673
+ "logs": [],
674
+ "kind": "describe",
675
+ "verdict": "ok"
676
+ },
677
+ {
678
+ "file": "string.spec.ts",
679
+ "order": 4,
680
+ "time": {
681
+ "start": 2.288672,
682
+ "end": 2.307505
683
+ },
684
+ "description": "Should deserialize strings",
685
+ "depth": 0,
686
+ "suites": [],
687
+ "tests": [
688
+ {
689
+ "verdict": "ok",
690
+ "_left": "abcdefg",
691
+ "_right": 1584,
692
+ "_not": false
693
+ },
694
+ {
695
+ "verdict": "ok",
696
+ "_left": "\"st\\\"ring\\\" w\\\"\\\"ith quotes\\\"\"",
697
+ "_right": 4240,
698
+ "_not": false
699
+ },
700
+ {
701
+ "verdict": "ok",
702
+ "_left": "\"string \\\"with random spa\\nces and \\nnewlines\\n\\n\\n\"",
703
+ "_right": 4432,
704
+ "_not": false
705
+ },
706
+ {
707
+ "verdict": "ok",
708
+ "_left": "\"string with colon : comma , brace [ ] bracket { } and quote \\\" and other quote \\\\\"\"",
709
+ "_right": 6336,
710
+ "_not": false
711
+ }
712
+ ],
713
+ "logs": [],
714
+ "kind": "describe",
715
+ "verdict": "ok"
716
+ }
717
+ ],
718
+ [],
719
+ [
720
+ {
721
+ "file": "integer.spec.ts",
722
+ "order": 5,
723
+ "time": {
724
+ "start": 4.95457,
725
+ "end": 5.030457
726
+ },
727
+ "description": "Should serialize integers",
728
+ "depth": 0,
729
+ "suites": [],
730
+ "tests": [
731
+ {
732
+ "verdict": "ok",
733
+ "_left": "0",
734
+ "_right": 1792,
735
+ "_not": false
736
+ },
737
+ {
738
+ "verdict": "ok",
739
+ "_left": "100",
740
+ "_right": 3760,
741
+ "_not": false
742
+ },
743
+ {
744
+ "verdict": "ok",
745
+ "_left": "101",
746
+ "_right": 3792,
747
+ "_not": false
748
+ },
749
+ {
750
+ "verdict": "ok",
751
+ "_left": "-100",
752
+ "_right": 3824,
753
+ "_not": false
754
+ },
755
+ {
756
+ "verdict": "ok",
757
+ "_left": "-101",
758
+ "_right": 3856,
759
+ "_not": false
760
+ }
761
+ ],
762
+ "logs": [],
763
+ "kind": "describe",
764
+ "verdict": "ok"
765
+ },
766
+ {
767
+ "file": "integer.spec.ts",
768
+ "order": 5,
769
+ "time": {
770
+ "start": 5.11372,
771
+ "end": 5.161068
772
+ },
773
+ "description": "Should deserialize integers",
774
+ "depth": 0,
775
+ "suites": [],
776
+ "tests": [
777
+ {
778
+ "verdict": "ok",
779
+ "_left": 0,
780
+ "_right": 0,
781
+ "_not": false
782
+ },
783
+ {
784
+ "verdict": "ok",
785
+ "_left": 100,
786
+ "_right": 100,
787
+ "_not": false
788
+ },
789
+ {
790
+ "verdict": "ok",
791
+ "_left": 101,
792
+ "_right": 101,
793
+ "_not": false
794
+ },
795
+ {
796
+ "verdict": "ok",
797
+ "_left": -100,
798
+ "_right": 4294967196,
799
+ "_not": false
800
+ },
801
+ {
802
+ "verdict": "ok",
803
+ "_left": -101,
804
+ "_right": 18446744073709552000,
805
+ "_not": false
806
+ }
807
+ ],
808
+ "logs": [],
809
+ "kind": "describe",
810
+ "verdict": "ok"
811
+ }
812
+ ],
813
+ [
814
+ {
815
+ "file": "float.spec.ts",
816
+ "order": 13,
817
+ "time": {
818
+ "start": 1.927763,
819
+ "end": 1.960894
820
+ },
821
+ "description": "Should serialize floats",
822
+ "depth": 0,
823
+ "suites": [],
824
+ "tests": [
825
+ {
826
+ "verdict": "ok",
827
+ "_left": "7.23",
828
+ "_right": 3408,
829
+ "_not": false
830
+ },
831
+ {
832
+ "verdict": "ok",
833
+ "_left": "1000.0",
834
+ "_right": 3536,
835
+ "_not": false
836
+ },
837
+ {
838
+ "verdict": "ok",
839
+ "_left": "1.23456",
840
+ "_right": 3568,
841
+ "_not": false
842
+ },
843
+ {
844
+ "verdict": "ok",
845
+ "_left": "0.0",
846
+ "_right": 1584,
847
+ "_not": false
848
+ },
849
+ {
850
+ "verdict": "ok",
851
+ "_left": "-7.23",
852
+ "_right": 3616,
853
+ "_not": false
854
+ },
855
+ {
856
+ "verdict": "ok",
857
+ "_left": "0.000001",
858
+ "_right": 3648,
859
+ "_not": false
860
+ },
861
+ {
862
+ "verdict": "ok",
863
+ "_left": "1e-7",
864
+ "_right": 3696,
865
+ "_not": false
866
+ },
867
+ {
868
+ "verdict": "ok",
869
+ "_left": 1e-7,
870
+ "_right": 4502148214488346600,
871
+ "_not": false
872
+ },
873
+ {
874
+ "verdict": "ok",
875
+ "_left": "100000000000000000000.0",
876
+ "_right": 3952,
877
+ "_not": false
878
+ },
879
+ {
880
+ "verdict": "ok",
881
+ "_left": "1e+21",
882
+ "_right": 4032,
883
+ "_not": false
884
+ },
885
+ {
886
+ "verdict": "ok",
887
+ "_left": 1e+21,
888
+ "_right": 4921056587992461000,
889
+ "_not": false
890
+ },
891
+ {
892
+ "verdict": "ok",
893
+ "_left": 1e+21,
894
+ "_right": 4921056587992461000,
895
+ "_not": false
896
+ },
897
+ {
898
+ "verdict": "ok",
899
+ "_left": 1e+21,
900
+ "_right": 4921056587992461000,
901
+ "_not": false
902
+ }
903
+ ],
904
+ "logs": [],
905
+ "kind": "describe",
906
+ "verdict": "ok"
907
+ },
908
+ {
909
+ "file": "float.spec.ts",
910
+ "order": 9,
911
+ "time": {
912
+ "start": 1.97298,
913
+ "end": 1.989046
914
+ },
915
+ "description": "Should deserialize floats",
916
+ "depth": 0,
917
+ "suites": [],
918
+ "tests": [
919
+ {
920
+ "verdict": "ok",
921
+ "_left": 7.23,
922
+ "_right": 4619826274753860000,
923
+ "_not": false
924
+ },
925
+ {
926
+ "verdict": "ok",
927
+ "_left": 1000,
928
+ "_right": 4652007308841189000,
929
+ "_not": false
930
+ },
931
+ {
932
+ "verdict": "ok",
933
+ "_left": 1.23456,
934
+ "_right": 4608238783128613400,
935
+ "_not": false
936
+ },
937
+ {
938
+ "verdict": "ok",
939
+ "_left": 0,
940
+ "_right": 0,
941
+ "_not": false
942
+ },
943
+ {
944
+ "verdict": "ok",
945
+ "_left": -7.23,
946
+ "_right": 13843198311608635000,
947
+ "_not": false
948
+ },
949
+ {
950
+ "verdict": "ok",
951
+ "_left": 0.000001,
952
+ "_right": 4517329193108107000,
953
+ "_not": false
954
+ },
955
+ {
956
+ "verdict": "ok",
957
+ "_left": 1e-7,
958
+ "_right": 4502148214488346600,
959
+ "_not": false
960
+ },
961
+ {
962
+ "verdict": "ok",
963
+ "_left": 100000000000000000000,
964
+ "_right": 4906019910204100000,
965
+ "_not": false
966
+ },
967
+ {
968
+ "verdict": "ok",
969
+ "_left": 1e+21,
970
+ "_right": 4921056587992461000,
971
+ "_not": false
972
+ }
973
+ ],
974
+ "logs": [],
975
+ "kind": "describe",
976
+ "verdict": "ok"
977
+ }
978
+ ],
979
+ [
980
+ {
981
+ "file": "bool.spec.ts",
982
+ "order": 4,
983
+ "time": {
984
+ "start": 1.531165,
985
+ "end": 1.544641
986
+ },
987
+ "description": "Should serialize booleans",
988
+ "depth": 0,
989
+ "suites": [],
990
+ "tests": [
991
+ {
992
+ "verdict": "ok",
993
+ "_left": "true",
994
+ "_right": 960,
995
+ "_not": false
996
+ },
997
+ {
998
+ "verdict": "ok",
999
+ "_left": "false",
1000
+ "_right": 992,
1001
+ "_not": false
1002
+ },
1003
+ {
1004
+ "verdict": "ok",
1005
+ "_left": "true",
1006
+ "_right": 960,
1007
+ "_not": false
1008
+ },
1009
+ {
1010
+ "verdict": "ok",
1011
+ "_left": "false",
1012
+ "_right": 992,
1013
+ "_not": false
1014
+ }
1015
+ ],
1016
+ "logs": [],
1017
+ "kind": "describe",
1018
+ "verdict": "ok"
1019
+ },
1020
+ {
1021
+ "file": "bool.spec.ts",
1022
+ "order": 2,
1023
+ "time": {
1024
+ "start": 1.568174,
1025
+ "end": 1.57639
1026
+ },
1027
+ "description": "Should deserialize booleans",
1028
+ "depth": 0,
1029
+ "suites": [],
1030
+ "tests": [
1031
+ {
1032
+ "verdict": "ok",
1033
+ "_left": true,
1034
+ "_right": 1,
1035
+ "_not": false
1036
+ },
1037
+ {
1038
+ "verdict": "ok",
1039
+ "_left": false,
1040
+ "_right": 0,
1041
+ "_not": false
1042
+ }
1043
+ ],
1044
+ "logs": [],
1045
+ "kind": "describe",
1046
+ "verdict": "ok"
1047
+ }
1048
+ ]
1049
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-as",
3
- "version": "0.9.26",
3
+ "version": "0.9.28",
4
4
  "description": "The only JSON library you'll need for AssemblyScript. SIMD enabled",
5
5
  "types": "assembly/index.ts",
6
6
  "author": "Jairus Tanaka",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-as/transform",
3
- "version": "0.9.26",
3
+ "version": "0.9.28",
4
4
  "description": "The only JSON library you'll need for AssemblyScript. SIMD enabled",
5
5
  "main": "./lib/index.js",
6
6
  "author": "Jairus Tanaka",
package/CHANGELOG DELETED
@@ -1,45 +0,0 @@
1
- v0.8.2 - Properties starting with `static` or `private` would be ignored
2
- v0.8.3 - Dirty fix to issue #68. Add __JSON_Stringify callable to global scope.
3
- v0.8.4 - Fix #71. Classes with the extending class overriding a property cause the property to be serialized twice.
4
- v0.8.5 - Fix #73. Support for nullable primatives with Box<T> from as-container
5
- v0.8.6 - Fix. Forgot to stash before publishing. Stash and push what should have been v0.8.5
6
-
7
- v0.9.0 - BREAKING CHANGE - API changed from JSON.parse(data, defaultValues) to JSON.parse(data). Default Values defaults to true. Large update. Refactor all the code, nullable primitives, rewrite the transform, allow extensibility with @omit keywords, and fix a plethora of bugs
8
- v0.9.1 - Fix #71
9
- v0.9.2 - Fix #75 + Build sizes significantly reduced
10
- v0.9.3 - Fix #76
11
- v0.9.4 - Fix #77
12
- v0.9.5 - Fix #46
13
- v0.9.6 - Fix bugs
14
- v0.9.7 - Update testing framework and readme logo
15
- v0.9.8 - Update dependencies
16
- v0.9.8a - Fix #80 - Empty Maps were not serialized to {}, instead, threw memory out of bounds
17
- v0.9.8b - Fix #81 - Revert transform
18
- v0.9.9 - Fix #82 - Initialize maps
19
- v0.9.9a - Remove extraneous logs from transform
20
- v0.9.10 - Fix transform type checks. switch to nodekind checks
21
- v0.9.11 - Remove MpZ--implement custom serializers and deserializers in the works
22
- v0.9.12 - Add compat with aspect
23
- v0.9.13 - Fix empty strings not indexing correctly
24
- v0.9.14 - Ignore properties of type Function
25
- v0.9.15 - Support JSON.Raw blocks
26
- v0.9.16 - JSON.Raw should be completely untouched
27
- v0.9.17 - A schema's parent's fields should be included properly
28
- v0.9.18 - Should be able to use @alias and @omit*** or JSON.Raw
29
- v0.9.19 - Fix arguments in @omitif declarations not working properly
30
- v0.9.20 - Strings were being received with quotes attached via the toString functionality. Removed that.
31
- v0.9.22 - Fix #89 and #93. Several bug fixes some severe such as ",null" being prepended when using @omit. Properly warn when a schema has fields that are not compatible with json
32
- v0.9.23 - Comment out SIMD-related code for now
33
- v0.9.24 - Remove transform changes from previous release
34
- v0.9.25 - Implement JSON.parseSafe
35
- v0.9.26 - Remove unnecessary dependencies
36
-
37
- [UNRELEASED] v1.0.0
38
- - Allow nullable primitives
39
- - Port over JSON.Value
40
- - Performance improvements
41
- - Add SIMD support
42
- - Introduce options
43
- - Custom serializers
44
- - Support arbitrary-length integers (@hypercubed/as-mpz)
45
- - Remove as-container (Box<T>)