json-as 1.0.0-beta.14 → 1.0.0-beta.16

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/CHANGELOG CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 2025-03-04 - 1.0.0-beta.16
4
+
5
+ - fix: isPrimitive should only trigger on actual primitives
6
+
7
+ ## 2025-03-04 - 1.0.0-beta.15
8
+
9
+ - fix: deserialize custom should take in string
10
+
3
11
  ## 2025-03-04 - 1.0.0-beta.14
4
12
 
5
13
  - fix: reference to nonexistent variable during custom deserialization layer 2
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
7
7
  █████ ███████ ██████ ██ ████ ██ ██ ███████
8
8
  </span>
9
- AssemblyScript - v1.0.0-beta.14
9
+ AssemblyScript - v1.0.0-beta.16
10
10
  </pre>
11
11
  </h5>
12
12
 
@@ -31,7 +31,7 @@ JSON is the de-facto serialization format of modern web applications, but its se
31
31
  ## 💾 Installation
32
32
 
33
33
  ```bash
34
- npm install json-as@1.0.0-beta.14
34
+ npm install json-as@1.0.0-beta.16
35
35
  ```
36
36
 
37
37
  Add the `--transform` to your `asc` command (e.g. in package.json)
package/assembly/index.ts CHANGED
@@ -588,7 +588,7 @@ export namespace JSON {
588
588
  // @ts-ignore: Defined by transform
589
589
  if (isDefined(type.__INITIALIZE)) changetype<nonnull<T>>(out).__INITIALIZE();
590
590
  // @ts-ignore
591
- return changetype<nonnull<T>>(out).__DESERIALIZE_CUSTOM(srcStart, srcEnd);
591
+ return changetype<nonnull<T>>(out).__DESERIALIZE_CUSTOM(ptrToStr(srcStart, srcEnd));
592
592
  // @ts-ignore: Defined by transform
593
593
  } else if (isDefined(type.__DESERIALIZE)) {
594
594
  return deserializeStruct<T>(srcStart, srcEnd, dst);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-as",
3
- "version": "1.0.0-beta.14",
3
+ "version": "1.0.0-beta.16",
4
4
  "author": "Jairus Tanaka",
5
5
  "repository": {
6
6
  "type": "git",
@@ -760,7 +760,7 @@ function strToNum(data: string, simd: boolean = false, offset: number = 0): stri
760
760
 
761
761
  function isPrimitive(type: string): boolean {
762
762
  const primitiveTypes = ["u8", "u16", "u32", "u64", "i8", "i16", "i32", "i64", "f32", "f64", "bool", "boolean"];
763
- return primitiveTypes.some((v) => type.includes(v));
763
+ return primitiveTypes.some((v) => type.startsWith(v));
764
764
  }
765
765
 
766
766
  function throwError(message: string, range: Range): never {