Skip to content

Instantly share code, notes, and snippets.

View KirdesMF's full-sized avatar
🏠
Working from home

KirdesGrvl KirdesMF

🏠
Working from home
View GitHub Profile
@KirdesMF
KirdesMF / checkForm.js
Created April 19, 2020 13:42
Helper / util to check value in a form
export const checkErrorsInput = (name, value) => {
let errors = {};
const options = {
isRequired: value.length === 0,
isInvalidName: value.length < 5,
isInvalidMessage: value.length < 15,
isInvalidMail: !/\S+@\S+\.\S+/.test(String(value).toLocaleLowerCase()),
isInvalidPhone: !/\b[\d]{10}\b/.test(value),
};