Fixed messages

This commit is contained in:
Sebastian Seedorf
2020-05-27 21:52:15 +02:00
parent 69a350c4da
commit 741b96ee50

View File

@@ -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.`;
}
},
};
}