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