@aeriajs/core 0.0.276 → 0.0.277

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.
@@ -121,11 +121,14 @@ const autoCast = (value, ctx) => {
121
121
  : value);
122
122
  }
123
123
  if ('format' in ctx.property) {
124
- if (ctx.property.format === 'date' || ctx.property.format === 'date-time') {
125
- const timestamp = Date.parse(value);
126
- return types_1.Result.result(!Number.isNaN(timestamp)
127
- ? new Date(timestamp)
128
- : null);
124
+ switch (ctx.property.format) {
125
+ case 'date':
126
+ case 'date-time': {
127
+ const timestamp = Date.parse(value);
128
+ return types_1.Result.result(!Number.isNaN(timestamp)
129
+ ? new Date(timestamp)
130
+ : null);
131
+ }
129
132
  }
130
133
  }
131
134
  break;
@@ -83,9 +83,12 @@ const autoCast = (value, ctx) => {
83
83
  return Result.result(ObjectId.isValid(value) ? new ObjectId(value) : value);
84
84
  }
85
85
  if ("format" in ctx.property) {
86
- if (ctx.property.format === "date" || ctx.property.format === "date-time") {
87
- const timestamp = Date.parse(value);
88
- return Result.result(!Number.isNaN(timestamp) ? new Date(timestamp) : null);
86
+ switch (ctx.property.format) {
87
+ case "date":
88
+ case "date-time": {
89
+ const timestamp = Date.parse(value);
90
+ return Result.result(!Number.isNaN(timestamp) ? new Date(timestamp) : null);
91
+ }
89
92
  }
90
93
  }
91
94
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/core",
3
- "version": "0.0.276",
3
+ "version": "0.0.277",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "aeriaMain": "tests/fixtures/aeriaMain.js",
@@ -42,13 +42,13 @@
42
42
  "mongodb-memory-server": "^10.1.4"
43
43
  },
44
44
  "peerDependencies": {
45
- "@aeriajs/builtins": "^0.0.276",
45
+ "@aeriajs/builtins": "^0.0.277",
46
46
  "@aeriajs/common": "^0.0.157",
47
47
  "@aeriajs/entrypoint": "^0.0.163",
48
- "@aeriajs/http": "^0.0.192",
49
- "@aeriajs/security": "^0.0.276",
48
+ "@aeriajs/http": "^0.0.193",
49
+ "@aeriajs/security": "^0.0.277",
50
50
  "@aeriajs/types": "^0.0.135",
51
- "@aeriajs/validation": "^0.0.177"
51
+ "@aeriajs/validation": "^0.0.178"
52
52
  },
53
53
  "dependencies": {
54
54
  "mongodb": "^6.17.0",