Zdockerovani, sjednoceni marginu, drobnejsi upravy
This commit is contained in:
@@ -1 +1,20 @@
|
||||
export const isRequired = (v) => !!v || "Required"
|
||||
export const isRequired = (val) => !!val || "Toto pole je povinné";
|
||||
export const isValidEmail = (email) => {
|
||||
const patternEmail = /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,10})+$/;
|
||||
return !!patternEmail.test(email) || "Tento e-mail není platný";
|
||||
};
|
||||
export const minLength = (length) => (val) => val.length >= length || `Zadej alespoň ${length} znaky`
|
||||
export const maxLength = (length) => (val) => val.length < length || `Zadej maximálně ${length} znaků`
|
||||
|
||||
|
||||
export const isEmptyArray = () => (val) => {
|
||||
return (val && val.length !== 0) || "Select item, please";
|
||||
};
|
||||
|
||||
export const isNumber = () => (val) => {
|
||||
return !isNaN(val) || "Only numbers are allowed";
|
||||
};
|
||||
|
||||
export const hasNoWhitespace = () => (val) => {
|
||||
return /^\S*$/.test(val) || "Don't use whitespaces";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user