@webiny/validation 6.1.0 → 6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/validation",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -15,19 +15,18 @@
15
15
  ],
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "isnumeric": "0.3.3",
19
- "lodash": "4.17.23"
18
+ "lodash": "4.18.1"
20
19
  },
21
20
  "devDependencies": {
22
21
  "@types/lodash": "4.17.24",
23
- "@webiny/build-tools": "6.1.0",
22
+ "@webiny/build-tools": "6.2.0",
24
23
  "rimraf": "6.1.3",
25
24
  "typescript": "5.9.3",
26
- "vitest": "4.1.2"
25
+ "vitest": "4.1.4"
27
26
  },
28
27
  "publishConfig": {
29
28
  "access": "public",
30
29
  "directory": "dist"
31
30
  },
32
- "gitHead": "65e0ac1889b3392c99b8cac6cde508e1e831c715"
31
+ "gitHead": "3d3148358b6febbc857371930871743bec3b3939"
33
32
  }
@@ -1,9 +1,7 @@
1
1
  import ValidationError from "../validationError.js";
2
- /**
3
- * Package isnumeric does not have types so we ignore it.
4
- */
5
- // @ts-expect-error
6
- import isNumeric from "isnumeric";
2
+ const isNumeric = value => {
3
+ return !isNaN(parseFloat(String(value))) && isFinite(Number(value));
4
+ };
7
5
 
8
6
  /**
9
7
  * @function number
@@ -1 +1 @@
1
- {"version":3,"names":["ValidationError","isNumeric","value","isNaN"],"sources":["numeric.ts"],"sourcesContent":["import ValidationError from \"~/validationError.js\";\n/**\n * Package isnumeric does not have types so we ignore it.\n */\n// @ts-expect-error\nimport isNumeric from \"isnumeric\";\n\n/**\n * @function number\n * @description This validator checks if the given value is numeric\n * @param {any} value\n * @return {boolean}\n */\nexport default (value: any) => {\n // Eliminate edge cases\n if (typeof value === \"undefined\" || value === 0 || value === \"0\") {\n return;\n }\n\n if (!value && !isNaN(value)) {\n return;\n }\n\n if (isNumeric(value)) {\n return;\n }\n\n throw new ValidationError(\"Value needs to be numeric.\");\n};\n"],"mappings":"AAAA,OAAOA,eAAe;AACtB;AACA;AACA;AACA;AACA,OAAOC,SAAS,MAAM,WAAW;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA,eAAgBC,KAAU,IAAK;EAC3B;EACA,IAAI,OAAOA,KAAK,KAAK,WAAW,IAAIA,KAAK,KAAK,CAAC,IAAIA,KAAK,KAAK,GAAG,EAAE;IAC9D;EACJ;EAEA,IAAI,CAACA,KAAK,IAAI,CAACC,KAAK,CAACD,KAAK,CAAC,EAAE;IACzB;EACJ;EAEA,IAAID,SAAS,CAACC,KAAK,CAAC,EAAE;IAClB;EACJ;EAEA,MAAM,IAAIF,eAAe,CAAC,4BAA4B,CAAC;AAC3D,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ValidationError","isNumeric","value","isNaN","parseFloat","String","isFinite","Number"],"sources":["numeric.ts"],"sourcesContent":["import ValidationError from \"~/validationError.js\";\nconst isNumeric = (value: unknown): boolean => {\n return !isNaN(parseFloat(String(value))) && isFinite(Number(value));\n};\n\n/**\n * @function number\n * @description This validator checks if the given value is numeric\n * @param {any} value\n * @return {boolean}\n */\nexport default (value: any) => {\n // Eliminate edge cases\n if (typeof value === \"undefined\" || value === 0 || value === \"0\") {\n return;\n }\n\n if (!value && !isNaN(value)) {\n return;\n }\n\n if (isNumeric(value)) {\n return;\n }\n\n throw new ValidationError(\"Value needs to be numeric.\");\n};\n"],"mappings":"AAAA,OAAOA,eAAe;AACtB,MAAMC,SAAS,GAAIC,KAAc,IAAc;EAC3C,OAAO,CAACC,KAAK,CAACC,UAAU,CAACC,MAAM,CAACH,KAAK,CAAC,CAAC,CAAC,IAAII,QAAQ,CAACC,MAAM,CAACL,KAAK,CAAC,CAAC;AACvE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,eAAgBA,KAAU,IAAK;EAC3B;EACA,IAAI,OAAOA,KAAK,KAAK,WAAW,IAAIA,KAAK,KAAK,CAAC,IAAIA,KAAK,KAAK,GAAG,EAAE;IAC9D;EACJ;EAEA,IAAI,CAACA,KAAK,IAAI,CAACC,KAAK,CAACD,KAAK,CAAC,EAAE;IACzB;EACJ;EAEA,IAAID,SAAS,CAACC,KAAK,CAAC,EAAE;IAClB;EACJ;EAEA,MAAM,IAAIF,eAAe,CAAC,4BAA4B,CAAC;AAC3D,CAAC","ignoreList":[]}