UNPKG

@adventurelabs/scout-core

Version:

Core utilities and helpers for Adventure Labs Scout applications

23 lines (22 loc) 471 B
/** * Ensure email conforms to basic email format x@y.z * @param email * @returns boolean * */ export function validateEmail(email) { // emails should be x@y const parts = email.split("@"); if (parts.length !== 2) { return false; } // x should not be empty if (parts[0].length === 0) { return false; } // y should have at least one dot if (!parts[1].includes(".")) { return false; } return true; }