json-as 0.5.38 → 0.5.41

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.
@@ -8,7 +8,10 @@ class Vec3 {
8
8
  x: i32;
9
9
  y: i32;
10
10
  z: i32;
11
- @inline __JSON_Deserialize(data: string, to: Vec3): Vec3 {
11
+ @inline __JSON_Deserialize(
12
+ data: string,
13
+ to: Vec3
14
+ ): Vec3 {
12
15
  let last = 1;
13
16
  let char = 0;
14
17
  let inStr = false;
@@ -19,16 +22,19 @@ class Vec3 {
19
22
  if (inStr === false && char === quoteCode) {
20
23
  if (key != null) {
21
24
  if (unsafeCharCodeAt(key, 0) == 120) {
22
- to.x = parseSciInteger<i32>(data.substring(last, pos - 1))
25
+ to.x = parseSciInteger<i32>(data.substring(last, pos - 1));
23
26
  } else if (unsafeCharCodeAt(key, 0) == 121) {
24
- to.y = parseSciInteger<i32>(data.substring(last, pos - 1))
27
+ to.y = parseSciInteger<i32>(data.substring(last, pos - 1));
25
28
  } else if (unsafeCharCodeAt(key, 0) == 122) {
26
- to.z = parseSciInteger<i32>(data.substring(last, pos - 1))
29
+ to.z = parseSciInteger<i32>(data.substring(last, pos - 1));
27
30
  }
28
31
  }
29
32
  last = ++pos;
30
33
  inStr = true;
31
- } else if (char === quoteCode && unsafeCharCodeAt(data, pos - 1) != backSlashCode) {
34
+ } else if (
35
+ char === quoteCode &&
36
+ unsafeCharCodeAt(data, pos - 1) != backSlashCode
37
+ ) {
32
38
  inStr = false;
33
39
  key = data.substring(last, pos);
34
40
  last = pos += 2;
@@ -36,11 +42,11 @@ class Vec3 {
36
42
  }
37
43
  if (key != null) {
38
44
  if (unsafeCharCodeAt(key, 0) == 120) {
39
- to.x = parseSciInteger<i32>(data.substring(last, pos - 1))
45
+ to.x = parseSciInteger<i32>(data.substring(last, pos - 1));
40
46
  } else if (unsafeCharCodeAt(key, 0) == 121) {
41
- to.y = parseSciInteger<i32>(data.substring(last, pos - 1))
47
+ to.y = parseSciInteger<i32>(data.substring(last, pos - 1));
42
48
  } else if (unsafeCharCodeAt(key, 0) == 122) {
43
- to.z = parseSciInteger<i32>(data.substring(last, pos - 1))
49
+ to.z = parseSciInteger<i32>(data.substring(last, pos - 1));
44
50
  }
45
51
  }
46
52
  return to;
@@ -53,7 +59,9 @@ const vec: Vec3 = {
53
59
  z: 8,
54
60
  };
55
61
 
56
- @inline function istr8<T extends number>(int: T): string {
62
+ @inline function istr8<
63
+ T extends number
64
+ >(int: T): string {
57
65
  if (int >= 100) {
58
66
  const str = changetype<string>(__new(6, idof<String>()));
59
67
  store<u16>(changetype<usize>(str), ((int / 100) % 10) + 48);
@@ -74,10 +82,10 @@ const vec: Vec3 = {
74
82
 
75
83
  bench("strint", () => {
76
84
  blackbox<string>(istr8<i32>(123));
77
- })
85
+ });
78
86
  bench("tostr", () => {
79
87
  blackbox<string>((<i32>123).toString());
80
- })
88
+ });
81
89
  bench("Stringify Object (Vec3)", () => {
82
90
  blackbox<string>(vec.__JSON_Serialize());
83
91
  });