json-as 0.9.27 → 0.9.29
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/.prettierrc.json +3 -1
- package/README.md +15 -68
- package/assembly/__benches__/misc.bench.ts +15 -14
- package/assembly/__tests__/date.spec.ts +12 -0
- package/assembly/__tests__/types.ts +17 -0
- package/assembly/custom/bs.ts +189 -198
- package/assembly/custom/chars.ts +2 -2
- package/assembly/custom/types.ts +1 -0
- package/assembly/custom/util.ts +47 -50
- package/assembly/deserialize/array/array.ts +24 -24
- package/assembly/deserialize/array/bool.ts +1 -1
- package/assembly/deserialize/array/float.ts +16 -16
- package/assembly/deserialize/array/integer.ts +16 -16
- package/assembly/deserialize/array/map.ts +20 -20
- package/assembly/deserialize/array/object.ts +20 -20
- package/assembly/deserialize/array/string.ts +1 -1
- package/assembly/deserialize/array.ts +2 -2
- package/assembly/deserialize/bool.ts +15 -15
- package/assembly/deserialize/date.ts +4 -4
- package/assembly/deserialize/float.ts +15 -15
- package/assembly/deserialize/integer.ts +8 -8
- package/assembly/deserialize/map.ts +111 -161
- package/assembly/deserialize/object.ts +16 -76
- package/assembly/deserialize/string.ts +70 -85
- package/assembly/index.ts +25 -24
- package/assembly/serialize/array.ts +37 -44
- package/assembly/serialize/bool.ts +2 -2
- package/assembly/serialize/date.ts +2 -2
- package/assembly/serialize/float.ts +2 -2
- package/assembly/serialize/integer.ts +3 -3
- package/assembly/serialize/map.ts +16 -16
- package/assembly/serialize/object.ts +4 -4
- package/assembly/serialize/string.ts +60 -63
- package/assembly/test.ts +3 -2
- package/package.json +2 -1
- package/transform/lib/index.js +29 -92
- package/transform/lib/index.js.map +1 -1
- package/transform/package.json +1 -1
- package/transform/src/index.ts +53 -186
package/assembly/index.ts
CHANGED
|
@@ -43,7 +43,7 @@ export namespace JSON {
|
|
|
43
43
|
Bool = 7,
|
|
44
44
|
String = 8,
|
|
45
45
|
Obj = 8,
|
|
46
|
-
Array = 9
|
|
46
|
+
Array = 9,
|
|
47
47
|
}
|
|
48
48
|
export type Raw = string;
|
|
49
49
|
export class Value {
|
|
@@ -52,7 +52,9 @@ export namespace JSON {
|
|
|
52
52
|
// @ts-ignore
|
|
53
53
|
private storage: u64;
|
|
54
54
|
|
|
55
|
-
private constructor() {
|
|
55
|
+
private constructor() {
|
|
56
|
+
unreachable();
|
|
57
|
+
}
|
|
56
58
|
|
|
57
59
|
/**
|
|
58
60
|
* Creates an JSON.Value instance from a given value.
|
|
@@ -125,12 +127,18 @@ export namespace JSON {
|
|
|
125
127
|
*/
|
|
126
128
|
toString(): string {
|
|
127
129
|
switch (this.type) {
|
|
128
|
-
case JSON.Types.U8:
|
|
129
|
-
|
|
130
|
-
case JSON.Types.
|
|
131
|
-
|
|
132
|
-
case JSON.Types.
|
|
133
|
-
|
|
130
|
+
case JSON.Types.U8:
|
|
131
|
+
return this.get<u8>().toString();
|
|
132
|
+
case JSON.Types.U16:
|
|
133
|
+
return this.get<u16>().toString();
|
|
134
|
+
case JSON.Types.U32:
|
|
135
|
+
return this.get<u32>().toString();
|
|
136
|
+
case JSON.Types.U64:
|
|
137
|
+
return this.get<u64>().toString();
|
|
138
|
+
case JSON.Types.String:
|
|
139
|
+
return '"' + this.get<string>() + '"';
|
|
140
|
+
case JSON.Types.Bool:
|
|
141
|
+
return this.get<boolean>() ? "true" : "false";
|
|
134
142
|
default: {
|
|
135
143
|
const arr = this.get<JSON.Value[]>();
|
|
136
144
|
if (!arr.length) return "[]";
|
|
@@ -152,7 +160,9 @@ export namespace JSON {
|
|
|
152
160
|
}
|
|
153
161
|
}
|
|
154
162
|
export class Box<T> {
|
|
155
|
-
constructor(public value: T) {
|
|
163
|
+
constructor(public value: T) {}
|
|
164
|
+
|
|
165
|
+
|
|
156
166
|
@inline static from<T>(value: T): Box<T> {
|
|
157
167
|
return new Box(value);
|
|
158
168
|
}
|
|
@@ -166,8 +176,7 @@ export namespace JSON {
|
|
|
166
176
|
* @param data T
|
|
167
177
|
* @returns string
|
|
168
178
|
*/
|
|
169
|
-
|
|
170
|
-
@inline export function stringify<T>(data: T/*, options: SerializeOptions = DEFAULT_SERIALIZE_OPTIONS*/): string {
|
|
179
|
+
export function stringify<T>(data: T /*, options: SerializeOptions = DEFAULT_SERIALIZE_OPTIONS*/): string {
|
|
171
180
|
if (isBoolean<T>()) {
|
|
172
181
|
return serializeBool(data as bool);
|
|
173
182
|
} else if (isInteger<T>() && nameof<T>() == "usize" && data == 0) {
|
|
@@ -202,9 +211,7 @@ export namespace JSON {
|
|
|
202
211
|
// @ts-ignore
|
|
203
212
|
return serializeMap(changetype<nonnull<T>>(data));
|
|
204
213
|
} else {
|
|
205
|
-
throw new Error(
|
|
206
|
-
`Could not serialize data of type ${nameof<T>()}. Make sure to add the correct decorators to classes.`
|
|
207
|
-
);
|
|
214
|
+
throw new Error(`Could not serialize data of type ${nameof<T>()}. Make sure to add the correct decorators to classes.`);
|
|
208
215
|
}
|
|
209
216
|
}
|
|
210
217
|
/**
|
|
@@ -215,9 +222,7 @@ export namespace JSON {
|
|
|
215
222
|
* @param data string
|
|
216
223
|
* @returns T
|
|
217
224
|
*/
|
|
218
|
-
|
|
219
|
-
// @ts-ignore: Decorator
|
|
220
|
-
@inline export function parse<T>(data: string): T {
|
|
225
|
+
export function parse<T>(data: string): T {
|
|
221
226
|
if (isBoolean<T>()) {
|
|
222
227
|
return deserializeBoolean(data) as T;
|
|
223
228
|
} else if (isInteger<T>()) {
|
|
@@ -246,9 +251,7 @@ export namespace JSON {
|
|
|
246
251
|
// @ts-ignore
|
|
247
252
|
return deserializeDate(data);
|
|
248
253
|
} else {
|
|
249
|
-
throw new Error(
|
|
250
|
-
`Could not deserialize data ${data} to type ${nameof<T>()}. Make sure to add the correct decorators to classes.`
|
|
251
|
-
);
|
|
254
|
+
throw new Error(`Could not deserialize data ${data} to type ${nameof<T>()}. Make sure to add the correct decorators to classes.`);
|
|
252
255
|
}
|
|
253
256
|
}
|
|
254
257
|
/**
|
|
@@ -290,9 +293,7 @@ export namespace JSON {
|
|
|
290
293
|
// @ts-ignore
|
|
291
294
|
return deserializeDate_Safe(data);
|
|
292
295
|
} else {
|
|
293
|
-
throw new Error(
|
|
294
|
-
`Could not deserialize data ${data} to type ${nameof<T>()}. Make sure to add the correct decorators to classes.`
|
|
295
|
-
);
|
|
296
|
+
throw new Error(`Could not deserialize data ${data} to type ${nameof<T>()}. Make sure to add the correct decorators to classes.`);
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
299
|
}
|
|
@@ -309,4 +310,4 @@ export namespace JSON {
|
|
|
309
310
|
// @ts-ignore: Decorator
|
|
310
311
|
@global @inline function __DESERIALIZE_SAFE<T>(data: string): T {
|
|
311
312
|
return JSON.parseSafe<T>(data);
|
|
312
|
-
}
|
|
313
|
+
}
|
|
@@ -1,51 +1,44 @@
|
|
|
1
1
|
import { JSON } from "..";
|
|
2
|
-
import {
|
|
3
|
-
COMMA,
|
|
4
|
-
COMMA_WORD,
|
|
5
|
-
EMPTY_BRACKET_WORD,
|
|
6
|
-
BRACKET_LEFT_WORD,
|
|
7
|
-
BRACKET_RIGHT,
|
|
8
|
-
BRACKET_RIGHT_WORD
|
|
9
|
-
} from "../custom/chars";
|
|
2
|
+
import { COMMA, COMMA_WORD, EMPTY_BRACKET_WORD, BRACKET_LEFT_WORD, BRACKET_RIGHT, BRACKET_RIGHT_WORD } from "../custom/chars";
|
|
10
3
|
import { Sink } from "../custom/sink";
|
|
11
4
|
import { serializeString } from "./string";
|
|
12
5
|
|
|
13
6
|
// @ts-ignore: Decorator valid here
|
|
14
7
|
@inline export function serializeArray<T extends any[]>(data: T): string {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
result += serializeString(unchecked(data[data.length - 1]));
|
|
28
|
-
result += BRACKET_RIGHT_WORD;
|
|
29
|
-
return result;
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
} else if (isBoolean<valueof<T>>()) {
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
return BRACKET_LEFT_WORD + data.join(COMMA_WORD) + BRACKET_RIGHT_WORD;
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
} else if (isFloat<valueof<T>>() || isInteger<valueof<T>>()) {
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
return BRACKET_LEFT_WORD + data.join(COMMA_WORD) + BRACKET_RIGHT_WORD;
|
|
38
|
-
} else {
|
|
39
|
-
let result = Sink.fromString(BRACKET_LEFT_WORD);
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
for (let i = 0; i < data.length - 1; i++) {
|
|
42
|
-
// @ts-ignore
|
|
43
|
-
result.write(JSON.stringify(unchecked(data[i])));
|
|
44
|
-
result.writeCodePoint(COMMA);
|
|
45
|
-
}
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
result.write(JSON.stringify(unchecked(data[data.length - 1])));
|
|
48
|
-
result.writeCodePoint(BRACKET_RIGHT);
|
|
49
|
-
return result.toString();
|
|
8
|
+
if (data.length == 0) {
|
|
9
|
+
return EMPTY_BRACKET_WORD;
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
} else if (isString<valueof<T>>()) {
|
|
12
|
+
let result = BRACKET_LEFT_WORD;
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
for (let i = 0; i < data.length - 1; i++) {
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
result += serializeString(unchecked(data[i]));
|
|
17
|
+
result += COMMA_WORD;
|
|
50
18
|
}
|
|
51
|
-
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
result += serializeString(unchecked(data[data.length - 1]));
|
|
21
|
+
result += BRACKET_RIGHT_WORD;
|
|
22
|
+
return result;
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
} else if (isBoolean<valueof<T>>()) {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
return BRACKET_LEFT_WORD + data.join(COMMA_WORD) + BRACKET_RIGHT_WORD;
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
} else if (isFloat<valueof<T>>() || isInteger<valueof<T>>()) {
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
return BRACKET_LEFT_WORD + data.join(COMMA_WORD) + BRACKET_RIGHT_WORD;
|
|
31
|
+
} else {
|
|
32
|
+
let result = Sink.fromString(BRACKET_LEFT_WORD);
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
for (let i = 0; i < data.length - 1; i++) {
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
result.write(JSON.stringify(unchecked(data[i])));
|
|
37
|
+
result.writeCodePoint(COMMA);
|
|
38
|
+
}
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
result.write(JSON.stringify(unchecked(data[data.length - 1])));
|
|
41
|
+
result.writeCodePoint(BRACKET_RIGHT);
|
|
42
|
+
return result.toString();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-ignore: Decorator valid here
|
|
2
2
|
@inline export function serializeInteger<T extends number>(data: T): string {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
3
|
+
// I have a much faster implementation of itoa that I will port over later. Its ~4x faster
|
|
4
|
+
return data.toString();
|
|
5
|
+
}
|
|
@@ -4,21 +4,21 @@ import { Sink } from "../custom/sink";
|
|
|
4
4
|
|
|
5
5
|
// @ts-ignore: Decorator valid here
|
|
6
6
|
@inline export function serializeMap<T extends Map<any, any>>(data: T): string {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
result.writeCodePoint(COLON);
|
|
15
|
-
result.write(JSON.stringify(unchecked(values[i])));
|
|
16
|
-
result.writeCodePoint(COMMA);
|
|
17
|
-
}
|
|
18
|
-
result.write(JSON.stringify(unchecked(keys[end]).toString()));
|
|
7
|
+
let result = Sink.fromString(BRACE_LEFT_WORD);
|
|
8
|
+
if (!data.size) return "{}";
|
|
9
|
+
let keys = data.keys();
|
|
10
|
+
let values = data.values();
|
|
11
|
+
const end = data.size - 1;
|
|
12
|
+
for (let i = 0; i < end; i++) {
|
|
13
|
+
result.write(JSON.stringify(unchecked(keys[i]).toString()));
|
|
19
14
|
result.writeCodePoint(COLON);
|
|
20
|
-
result.write(JSON.stringify(unchecked(values[
|
|
15
|
+
result.write(JSON.stringify(unchecked(values[i])));
|
|
16
|
+
result.writeCodePoint(COMMA);
|
|
17
|
+
}
|
|
18
|
+
result.write(JSON.stringify(unchecked(keys[end]).toString()));
|
|
19
|
+
result.writeCodePoint(COLON);
|
|
20
|
+
result.write(JSON.stringify(unchecked(values[end])));
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
22
|
+
result.writeCodePoint(BRACE_RIGHT);
|
|
23
|
+
return result.toString();
|
|
24
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
interface GeneratedInterface {
|
|
2
|
-
|
|
2
|
+
__SERIALIZE(): string;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
// @ts-ignore: Decorator valid here
|
|
6
6
|
@inline export function serializeObject<T extends GeneratedInterface>(data: T): string {
|
|
7
|
-
|
|
7
|
+
return changetype<nonnull<T>>(data).__SERIALIZE();
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
// @ts-ignore: Decorator valid here
|
|
11
11
|
@inline export function serializeObject_Pretty<T extends GeneratedInterface>(data: T): string {
|
|
12
|
-
|
|
13
|
-
}
|
|
12
|
+
return changetype<nonnull<T>>(data).__SERIALIZE_PRETTY();
|
|
13
|
+
}
|
|
@@ -32,7 +32,7 @@ import { Sink } from "../custom/sink";
|
|
|
32
32
|
|
|
33
33
|
// /**
|
|
34
34
|
// * A prototype SIMD implementation for string serialization which can only work in 128-byte (or 16 chars with wtf-16).
|
|
35
|
-
// *
|
|
35
|
+
// *
|
|
36
36
|
// * A faster version could perhaps look like the following:
|
|
37
37
|
// */
|
|
38
38
|
// // @ts-ignore: Decorator
|
|
@@ -77,7 +77,6 @@ import { Sink } from "../custom/sink";
|
|
|
77
77
|
// }
|
|
78
78
|
// }
|
|
79
79
|
|
|
80
|
-
|
|
81
80
|
// const back_slash_reg = i16x8.splat(92); // "\"
|
|
82
81
|
// const quote_reg = i16x8.splat(34); // "\""
|
|
83
82
|
|
|
@@ -96,7 +95,6 @@ import { Sink } from "../custom/sink";
|
|
|
96
95
|
// const quote_mask = i16x8.eq(block, quote_reg);
|
|
97
96
|
// const is_quote_or_backslash = v128.or(quote_mask, backslash_mask);
|
|
98
97
|
// console.log("mask: " + prt10(is_quote_or_backslash))
|
|
99
|
-
|
|
100
98
|
|
|
101
99
|
// // store<v128>(dst_ptr, expanded);
|
|
102
100
|
// src_ptr += 8;
|
|
@@ -146,66 +144,66 @@ import { Sink } from "../custom/sink";
|
|
|
146
144
|
|
|
147
145
|
// @ts-ignore: Decorator
|
|
148
146
|
@inline export function serializeString(data: string): string {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
case 12: {
|
|
182
|
-
result.write("\\f");
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
case 13: {
|
|
186
|
-
result.write("\\r");
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
default: {
|
|
190
|
-
// all chars 0-31 must be encoded as a four digit unicode escape sequence
|
|
191
|
-
// \u0000 to \u000f handled here
|
|
192
|
-
result.write("\\u000");
|
|
193
|
-
result.write(char.toString(16));
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
} else if (char < 32) {
|
|
198
|
-
result.write(<string>data, last, i);
|
|
199
|
-
last = i + 1;
|
|
200
|
-
// all chars 0-31 must be encoded as a four digit unicode escape sequence
|
|
201
|
-
// \u0010 to \u001f handled here
|
|
202
|
-
result.write("\\u00");
|
|
203
|
-
result.write(char.toString(16));
|
|
147
|
+
// if (!needsEscaping(data)) {
|
|
148
|
+
// return "\"" + data + "\"";
|
|
149
|
+
// }
|
|
150
|
+
|
|
151
|
+
if (data.length === 0) {
|
|
152
|
+
return '""';
|
|
153
|
+
}
|
|
154
|
+
let result = Sink.fromString('"');
|
|
155
|
+
|
|
156
|
+
let last: i32 = 0;
|
|
157
|
+
for (let i = 0; i < data.length; i++) {
|
|
158
|
+
const char = unsafeCharCodeAt(<string>data, i);
|
|
159
|
+
if (char === 34 || char === 92) {
|
|
160
|
+
result.write(<string>data, last, i);
|
|
161
|
+
result.writeCodePoint(92);
|
|
162
|
+
last = i;
|
|
163
|
+
} else if (char < 16) {
|
|
164
|
+
result.write(<string>data, last, i);
|
|
165
|
+
last = i + 1;
|
|
166
|
+
switch (char) {
|
|
167
|
+
case 8: {
|
|
168
|
+
result.write("\\b");
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
case 9: {
|
|
172
|
+
result.write("\\t");
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
case 10: {
|
|
176
|
+
result.write("\\n");
|
|
177
|
+
break;
|
|
204
178
|
}
|
|
179
|
+
case 12: {
|
|
180
|
+
result.write("\\f");
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
case 13: {
|
|
184
|
+
result.write("\\r");
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
default: {
|
|
188
|
+
// all chars 0-31 must be encoded as a four digit unicode escape sequence
|
|
189
|
+
// \u0000 to \u000f handled here
|
|
190
|
+
result.write("\\u000");
|
|
191
|
+
result.write(char.toString(16));
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
} else if (char < 32) {
|
|
196
|
+
result.write(<string>data, last, i);
|
|
197
|
+
last = i + 1;
|
|
198
|
+
// all chars 0-31 must be encoded as a four digit unicode escape sequence
|
|
199
|
+
// \u0010 to \u001f handled here
|
|
200
|
+
result.write("\\u00");
|
|
201
|
+
result.write(char.toString(16));
|
|
205
202
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
203
|
+
}
|
|
204
|
+
result.write(<string>data, last);
|
|
205
|
+
result.writeCodePoint(34);
|
|
206
|
+
return result.toString();
|
|
209
207
|
}
|
|
210
208
|
|
|
211
209
|
// // @ts-ignore: Decorator valid here
|
|
@@ -218,7 +216,6 @@ import { Sink } from "../custom/sink";
|
|
|
218
216
|
|
|
219
217
|
// bs.write_16(QUOTE);
|
|
220
218
|
|
|
221
|
-
|
|
222
219
|
// let last: i32 = 0;
|
|
223
220
|
// for (let i = 0; i < len; i += 2) {
|
|
224
221
|
// const char = load<u16>(changetype<usize>(data) + i);
|
|
@@ -284,4 +281,4 @@ import { Sink } from "../custom/sink";
|
|
|
284
281
|
// bs.write_s_se(<string>data, last, changetype<OBJECT>(changetype<usize>(data) - TOTAL_OVERHEAD).rtSize);
|
|
285
282
|
// bs.write_16(QUOTE);
|
|
286
283
|
// }
|
|
287
|
-
// }
|
|
284
|
+
// }
|
package/assembly/test.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { JSON } from "."
|
|
1
|
+
import { JSON } from ".";
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
@json
|
|
4
5
|
class Vec3 {
|
|
@@ -31,4 +32,4 @@ class Vec3 {
|
|
|
31
32
|
const serialized = JSON.stringify(new Vec3());
|
|
32
33
|
console.log("Serialized: " + serialized);
|
|
33
34
|
const deserialized = JSON.parseSafe<Vec3>(`{"x":1,"y":true,"z":3}`);
|
|
34
|
-
console.log("Deserialized: " + JSON.stringify(deserialized));
|
|
35
|
+
console.log("Deserialized: " + JSON.stringify(deserialized));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-as",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.29",
|
|
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",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"assemblyscript": "^0.27.29",
|
|
38
38
|
"assemblyscript-prettier": "^3.0.1",
|
|
39
39
|
"benchmark": "^2.1.4",
|
|
40
|
+
"json-as": "file:.",
|
|
40
41
|
"microtime": "^3.1.1",
|
|
41
42
|
"prettier": "^3.3.3",
|
|
42
43
|
"tinybench": "^2.8.0",
|