Function isEmail

  • Validate an email

    Parameters

    • input: unknown

      The raw input

    Returns Validated<RegexResult<"user" | "domain">>

    Example

    isEmail("user@domain.com") >>
    {
    valid: true,
    parsed: {
    match: "user@domain.com",
    index: 0,
    captured: ["user", "domain.com"],
    named: {
    user: "user",
    domain: "domain.com",
    },
    },
    };

    isEmail("") >>
    {
    valid: false,
    error: 'Not an email: ""',
    };