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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
Example
Section titled “Example”isEmail("alice@example.com"); // trueisEmail("nope"); // false (no @)isEmail("no@domain"); // false (no dotted domain)