From 741b96ee508cb860530015e0e2b6a7bde7657523 Mon Sep 17 00:00:00 2001 From: Sebastian Seedorf Date: Wed, 27 May 2020 21:52:15 +0200 Subject: [PATCH] Fixed messages --- validators/number.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/validators/number.ts b/validators/number.ts index 5fbb862..e32ffe5 100644 --- a/validators/number.ts +++ b/validators/number.ts @@ -107,11 +107,15 @@ export function hasParity( return { partity: "even" }; } if (divisibleBy !== undefined && (value % divisibleBy !== 0)) { - return { divisibleBy: "divisibleBy" }; + return { divisibleBy }; } }, message: (value: any, args?: Args) => { - return `This value is not in the given range.`; + if (args?.hasOwnProperty("divisibleBy")) { + return `This value is not divisible by ${divisibleBy}.`; + } else { + return `This value has a wrong partiy.`; + } }, }; }