Skip to content

Function: isEmail()

isEmail(value): boolean

Pragmatic local@domain.tld shape check: non-empty local and domain parts around a single @, with a dotted domain and no whitespace. Deliberately loose (not full RFC 5322) - enough to catch obvious typos and give CLI / form feedback, not to gate delivery. Trims first. This is a purely syntactic test, so a wildcard allow-list pattern like *@example.com passes; distinguishing a pattern from a real address is the sender policy’s job, not this validator’s.

string

boolean

isEmail("alice@example.com"); // true
isEmail("nope"); // false (no @)
isEmail("no@domain"); // false (no dotted domain)