quantique-converter
Version:
Converters for all kind of data
23 lines (21 loc) • 869 B
JavaScript
// Default error messages
const defaultErrorMessages = (rules, type) => {
return {
noSpace: "Value should not contain spaces",
minAge: `User must be ${rules.minAge} years or older`,
minMinus: "Date is too far in the past",
maxPlus: "Date is too far in the future",
required: "This field is required",
minLength: `Minimum length should be ${rules.minLength}`,
maxLength: `Maximum length should be ${rules.maxLength}`,
invalid: `Invalid ${type}`,
noValidation: `No validation exist for ${type}`,
custom: "Validation failed",
Alphanumeric: "value must be alphanumeric",
chassisNumber: "Invalid chassis number",
engineNumber: "Invalid engine number",
customValidation:
rules.errorMessages?.customValidation || "Custom validation failed",
};
};
module.exports = defaultErrorMessages;