@vorplex/core 0.0.46 → 0.0.47

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.
@@ -63,16 +63,16 @@ export class TsonArray extends TsonSchemaBase {
63
63
  throw new TsonError(`Array min length of ${this.definition.min} expected`, value, this);
64
64
  if (this.definition.max != null && value.length > this.definition.max)
65
65
  throw new TsonError(`Array max length of ${this.definition.max} expected`, value, this);
66
- if (this.definition.itemDefinition) {
67
- for (const [index, item] of value.entries()) {
68
- try {
69
- result[index] = $Tson.parse(this.definition.itemDefinition).parse(item);
70
- }
71
- catch (error) {
72
- if (!(error instanceof TsonError))
73
- throw error;
74
- throw new TsonError(`Invalid item in array. ${error.message}`, item, this, `[${index}]${error.path}`);
75
- }
66
+ if (!this.definition.itemDefinition)
67
+ return [...value];
68
+ for (const [index, item] of value.entries()) {
69
+ try {
70
+ result[index] = $Tson.parse(this.definition.itemDefinition).parse(item);
71
+ }
72
+ catch (error) {
73
+ if (!(error instanceof TsonError))
74
+ throw error;
75
+ throw new TsonError(`Invalid item in array. ${error.message}`, item, this, `[${index}]${error.path}`);
76
76
  }
77
77
  }
78
78
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vorplex/core",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [