File: /var/www/quadcode.com/builds/-DFbjr9L/0/foach/quadcode.com/src/routes/api/send/email/Validation.ts
import type { IRequest } from '../../../../type/form';
const Validation = (value: IRequest) => {
const error: { [name: string]: string } = {};
if (Object.values(value).length) {
if (value['email'] === undefined || value['email'] === '') {
error['email'] = '*Required field';
} else {
if (
!value['email'].match(
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
)
) {
error['email'] = '*Not valid email';
}
}
} else {
error['email'] = '*Required field';
}
return error;
};
export default Validation;