verificator
Version:
Client and server-side validation JavaScript library
57 lines (56 loc) • 5.26 kB
JavaScript
export const messages = {
accepted: ({ attribute }) => `The ${attribute} must be accepted.`,
after: ({ attribute, parameters: [date] }) => `The ${attribute} must be a date after ${date}.`,
after_or_equal: ({ attribute, parameters: [date] }) => `The ${attribute} must be a date after or equal to ${date}.`,
alpha: ({ attribute }) => `The ${attribute} may only contain letters.`,
alpha_dash: ({ attribute }) => `The ${attribute} may only contain letters, numbers, and dashes.`,
alpha_num: ({ attribute }) => `The ${attribute} may only contain letters and numbers.`,
array: ({ attribute }) => `The ${attribute} must be an array.`,
before: ({ attribute, parameters: [date] }) => `The ${attribute} must be a date before ${date}.`,
before_or_equal: ({ attribute, parameters: [date] }) => `The ${attribute} must be a date before or equal to ${date}.`,
'between:numeric': ({ attribute, parameters: [min, max] }) => `The ${attribute} must be between ${min} and ${max}.`,
'between:string': ({ attribute, parameters: [min, max] }) => `The ${attribute} must be between ${min} and ${max} characters.`,
'between:array': ({ attribute, parameters: [min, max] }) => `The ${attribute} must have between ${min} and ${max} items.`,
boolean: ({ attribute }) => `The ${attribute} field must be true or false.`,
confirmed: ({ attribute }) => `The ${attribute} confirmation does not match.`,
date: ({ attribute }) => `The ${attribute} is not a valid date.`,
date_equals: ({ attribute, parameters: [date] }) => `The ${attribute} must be a date equal to ${date}.`,
date_format: ({ attribute, parameters: [format] }) => `The ${attribute} does not match the format ${format}.`,
different: ({ attribute, parameters: [other] }) => `The ${attribute} and ${other} must be different.`,
digits: ({ attribute, parameters: [digits] }) => `The ${attribute} must be ${digits} digits.`,
digits_between: ({ attribute, parameters: [min, max] }) => `The ${attribute} must be between ${min} and ${max} digits.`,
distinct: ({ attribute }) => `The ${attribute} field has a duplicate value.`,
email: ({ attribute }) => `The ${attribute} must be a valid email address.`,
filled: ({ attribute }) => `The ${attribute} field must have a value.`,
in: ({ attribute }) => `The selected ${attribute} is invalid.`,
in_array: ({ attribute, parameters: [other] }) => `The ${attribute} field does not exist in ${other}.`,
integer: ({ attribute }) => `The ${attribute} must be an integer.`,
ip: ({ attribute }) => `The ${attribute} must be a valid IP address.`,
ipv4: ({ attribute }) => `The ${attribute} must be a valid IPv4 address.`,
ipv6: ({ attribute }) => `The ${attribute} must be a valid IPv6 address.`,
json: ({ attribute }) => `The ${attribute} must be a valid JSON string.`,
'max:numeric': ({ attribute, parameters: [max] }) => `The ${attribute} may not be greater than ${max}.`,
'max:string': ({ attribute, parameters: [max] }) => `The ${attribute} may not be greater than ${max} characters.`,
'max:array': ({ attribute, parameters: [max] }) => `The ${attribute} may not have more than ${max} items.`,
'min:numeric': ({ attribute, parameters: [min] }) => `The ${attribute} must be at least ${min}.`,
'min:string': ({ attribute, parameters: [min] }) => `The ${attribute} must be at least ${min} characters.`,
'min:array': ({ attribute, parameters: [min] }) => `The ${attribute} must have at least ${min} items.`,
not_in: ({ attribute }) => `The selected ${attribute} is invalid.`,
numeric: ({ attribute }) => `The ${attribute} must be a number.`,
present: ({ attribute }) => `The ${attribute} field must be present.`,
regex: ({ attribute }) => `The ${attribute} format is invalid.`,
required: ({ attribute }) => `The ${attribute} field is required.`,
required_if: ({ attribute, parameters: [other, value] }) => `The ${attribute} field is required when ${other} is ${value}.`,
required_unless: ({ attribute, parameters: [other, value] }) => `The ${attribute} field is required unless ${other} is in ${value}.`,
required_with: ({ attribute, parameters }) => `The ${attribute} field is required when ${parameters.join(' / ')} is present.`,
required_with_all: ({ attribute, parameters }) => `The ${attribute} field is required when ${parameters.join(' / ')} is present.`,
required_without: ({ attribute, parameters }) => `The ${attribute} field is required when ${parameters.join(' / ')} is not present.`,
required_without_all: ({ attribute, parameters }) => `The ${attribute} field is required when none of ${parameters.join(' / ')} are present.`,
same: ({ attribute, parameters: [other] }) => `The ${attribute} and ${other} must match.`,
'size:numeric': ({ attribute, parameters: [size] }) => `The ${attribute} must be ${size}.`,
'size:string': ({ attribute, parameters: [size] }) => `The ${attribute} must be ${size} characters.`,
'size:array': ({ attribute, parameters: [size] }) => `The ${attribute} must contain ${size} items.`,
string: ({ attribute }) => `The ${attribute} must be a string.`,
url: ({ attribute }) => `The ${attribute} format is invalid.`,
};
export const attributes = {};