From 7c6d658e65e15049e63f9bcef258efdb621a2fe5 Mon Sep 17 00:00:00 2001 From: LKHO Date: Sat, 11 Mar 2017 12:14:21 +0800 Subject: [PATCH] fix double validator --- src/utils/validators.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/validators.js b/src/utils/validators.js index 0cfcf9b0..c44bebac 100644 --- a/src/utils/validators.js +++ b/src/utils/validators.js @@ -85,7 +85,7 @@ module.exports = { double(value, field) { let res = checkEmpty(value, field.required); if (res != null) return res; - if (!(Number(value) === value && value % 1 !== 0)) + if (!isNumber(value) || isNaN(value)) return [msg(resources.invalidNumber)]; }, @@ -227,4 +227,4 @@ module.exports = { if (!re.test(value)) return [msg(resources.invalidTextContainSpec)]; } -}; \ No newline at end of file +};