@noreajs/core
Advanced tools
Comparing version 1.1.9 to 2.0.0-0
@@ -5,3 +5,3 @@ /// <reference types="qs" /> | ||
type DataOriginType = "query" | "body" | "params"; | ||
type FieldType = "string" | "object" | "array" | "bool" | "date" | "timestamp" | "double" | "int" | "long" | "decimal"; | ||
type FieldType = "string" | "object" | "array" | "bool" | "date" | "timestamp" | "number" | "double" | "int" | "long" | "decimal"; | ||
interface RuleType { | ||
@@ -8,0 +8,0 @@ message?: string | ((value: any, field: string, origin: DataOriginType, options: FieldValidationOptions, data: any) => string | Promise<string>); |
@@ -216,6 +216,7 @@ "use strict"; | ||
/** | ||
* Decimal types | ||
* Integer | ||
*/ | ||
case "decimal": | ||
case "double": | ||
case "int": | ||
case "long": | ||
case "timestamp": | ||
switch (origin) { | ||
@@ -235,3 +236,3 @@ case "body": | ||
case "params": | ||
if (isNaN(parseFloat(`${value}`))) { | ||
if (isNaN(parseInt(`${value}`))) { | ||
addError({ | ||
@@ -249,7 +250,6 @@ origin, | ||
/** | ||
* Integer | ||
* Decimal types | ||
*/ | ||
case "int": | ||
case "long": | ||
case "timestamp": | ||
case "decimal": | ||
case "double": | ||
switch (origin) { | ||
@@ -269,3 +269,3 @@ case "body": | ||
case "params": | ||
if (isNaN(parseInt(`${value}`))) { | ||
if (isNaN(parseFloat(`${value}`))) { | ||
addError({ | ||
@@ -283,2 +283,16 @@ origin, | ||
/** | ||
* Global number | ||
*/ | ||
case "number": | ||
if (value !== `${Number(value)}`) { | ||
addError({ | ||
origin, | ||
field: field, | ||
type: fieldType, | ||
value, | ||
message: [typeErrorMessage], | ||
}); | ||
} | ||
break; | ||
/** | ||
* Object | ||
@@ -285,0 +299,0 @@ */ |
{ | ||
"name": "@noreajs/core", | ||
"version": "1.1.9", | ||
"version": "2.0.0-0", | ||
"description": "Norea.Js is a sets of tools for the development of API with Node.Js.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109398
2609
2