Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

email-syntax

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

email-syntax

Email addresses syntax validations library

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

email-syntax

Email addresses syntax validations library

Build Status Coverage Status

Syntax email addresses verification based on RFC5321 and RFC5322. Version 2 is full remake of original one using TypeScript. Now it's a class with one static method "validate". Library can be used in Node.js back-end and in Angular 4 front-end projects.

Installation

Install Email Syntax as an npm module and save it to your package.json file as a dependency:

npm install --save email-syntax

Usage

Usage of validator is simple as 2 + 2. You need to import class and then use its "validate()" method.

Node.js

    const EmailSyntax = require('email-syntax').EmailSyntax;

    if (EmailSyntax.validate('test@some-mail.com')){
        console.log('This address is valid');
    }

On server environment you can use additional methods:

  • split(address) - Splits email address to local part and domain name
  • extractFromQuotes(localPart) - Checks if quoted and extracts local part
  • validateDomainName(domainName) - Validates domain name syntaxis
  • validateLocalPart(localPart) - Validates local-part of address
  • isValidIpAddress(domainName) - Checks if domain name is a valid ip address like 1.2.3.4

Angular 2/4

    import { EmailSyntax } from 'email-syntax';

    function isEmailValid(address): boolean{
        return EmailSyntax.validate(address);
    }

Tests

npm test

Keywords

FAQs

Package last updated on 13 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc