@ssense/restify-request-validator
Advanced tools
Comparing version 1.1.11 to 1.1.12
@@ -5,4 +5,5 @@ "use strict"; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./RequestValidator")); | ||
__export(require("./ParamValidation")); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ParamValidation = (function () { | ||
@@ -3,0 +4,0 @@ function ParamValidation() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ParamValidation_1 = require("./ParamValidation"); | ||
@@ -212,3 +213,10 @@ var supportedTypes = ['string', 'number', 'boolean', 'numeric', 'date', 'array', 'object']; | ||
} | ||
else if (typeValidation.type === 'numeric' || typeValidation.type === 'number') { | ||
else if (typeValidation.type === 'numeric') { | ||
var isNumeric = !(typeValidation.value.length === 0) && !isNaN(typeValidation.value); | ||
if (isNumeric === true) { | ||
typeValidation.value = parseInt(typeValidation.value, 10); | ||
} | ||
return isNumeric; | ||
} | ||
else if (typeValidation.type === 'number') { | ||
var isNumeric = !isNaN(typeValidation.value); | ||
@@ -221,3 +229,7 @@ if (isNumeric === true) { | ||
else if (typeValidation.type === 'boolean') { | ||
return ['0', '1', 'false', 'true', false, true, 0, 1].indexOf(typeValidation.value) !== -1; | ||
var isBoolean = ['0', '1', 'false', 'true', false, true, 0, 1].indexOf(typeValidation.value) !== -1; | ||
if (isBoolean === true) { | ||
typeValidation.value = ['1', 'true', true, 1].indexOf(typeValidation.value) !== -1; | ||
} | ||
return isBoolean; | ||
} | ||
@@ -224,0 +236,0 @@ else if (typeValidation.type === 'date') { |
{ | ||
"name": "@ssense/restify-request-validator", | ||
"version": "1.1.11", | ||
"version": "1.1.12", | ||
"description": "Restify requests validator", | ||
@@ -5,0 +5,0 @@ "main": "js/index.js", |
@@ -142,3 +142,3 @@ # Restify request validator | ||
By default, every `numeric` and `date` inputs will be automatically transformed respectively to valid `number` and `Date` objects after validation. So you can directly use valid objects in your code. | ||
By default, every `numeric`, `date` and `boolean` inputs will be automatically transformed respectively to valid `number`, `Date` and `boolean` objects after validation. So you can directly use valid objects in your code. | ||
@@ -145,0 +145,0 @@ ##### Extra formatting, data transformation |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
141402
360