game-data-gen 2.1.0 → 2.2.0

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.
@@ -25,6 +25,8 @@ export function addFieldDefinition(field, baseLength, output) {
25
25
  case ArrayType.BOOLEAN:
26
26
  output.push(`export let ${fieldName} = new Array<boolean>(${fieldArrayLength})${fieldArrayLength ? ".fill(false)" : ""}`);
27
27
  break;
28
+ default:
29
+ output.push(`export let ${fieldName} = new Array<${getName(fieldArrayType)}>()`);
28
30
  }
29
31
  }
30
32
  break;
@@ -86,6 +88,8 @@ function zeroField(name, type, arrayType, length, output) {
86
88
  case ArrayType.BOOLEAN:
87
89
  output.push(` ${name}.${length ? "fill(false)" : "length = 0"}`);
88
90
  break;
91
+ default:
92
+ output.push(` ${name}.length = 0`);
89
93
  }
90
94
  }
91
95
  break;
@@ -43,6 +43,8 @@ function addStructCreateFunction(name, fields, output) {
43
43
  case ArrayType.BOOLEAN:
44
44
  output.push(` obj.${fieldName} = new Array<boolean>(${fieldArrayLength})${fieldArrayLength ? ".fill(false)" : ""}`);
45
45
  break;
46
+ default:
47
+ output.push(` obj.${fieldName} = new Array<${getName(fieldArrayType)}>()`);
46
48
  }
47
49
  }
48
50
  break;
@@ -85,6 +87,8 @@ function addStructZeroFunction(name, fields, output) {
85
87
  case ArrayType.BOOLEAN:
86
88
  output.push(` obj.${fieldName}.${fieldArrayLength ? "fill(false)" : "length = 0"}`);
87
89
  break;
90
+ default:
91
+ output.push(` obj.${fieldName}.length = 0`);
88
92
  }
89
93
  }
90
94
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "game-data-gen",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"