badmfck-api-server 3.0.0 → 3.0.1

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.
@@ -89,7 +89,7 @@ async function Initializer(services) {
89
89
  exports.Initializer = Initializer;
90
90
  class APIService extends BaseService_1.BaseService {
91
91
  static nextLogID = 0;
92
- version = "3.0.0";
92
+ version = "3.0.1";
93
93
  options;
94
94
  monitor = null;
95
95
  monitorIndexFile;
@@ -48,6 +48,15 @@ class Validator {
48
48
  for (let i in structure) {
49
49
  if (!(i in object))
50
50
  errors.push("no field '" + i + "'");
51
+ if (typeof structure[i] === "number" && typeof object[i] === "string") {
52
+ let num = parseInt(object[i]);
53
+ if (object[i].includes(","))
54
+ num = parseFloat(object[i]);
55
+ if (isNaN(num))
56
+ errors.push("wrong value for field '" + i + "', expected number got " + object[i]);
57
+ else
58
+ object[i] = num;
59
+ }
51
60
  if (typeof object[i] !== typeof structure[i])
52
61
  errors.push("wrong datatype for field '" + i + "' expected " + typeof structure[i] + " got " + typeof object[i]);
53
62
  if (typeof structure[i] === "object" || typeof structure[i] === "function") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",