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 - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

lib/email-syntax.d.ts

18

package.json
{
"name": "email-syntax",
"version": "1.0.0",
"version": "2.0.0",
"description": "Email addresses syntax validations library",
"main": "index.js",
"main": "./lib/email-syntax.js",
"typings": "./lib/email-syntax.d.ts",
"scripts": {
"test": "mocha --reporter spec",
"cover": "node node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha -- -R spec test/*"
"test": "rm -rf lib && tsc && node ./node_modules/istanbul/lib/cli.js cover ./node_modules/jasmine/bin/jasmine.js ./spec/**[sS]pec.js",
"compile": "rm -rf lib && tsc"
},

@@ -19,3 +20,5 @@ "repository": {

"syntax",
"address"
"address",
"angular",
"angular 4"
],

@@ -29,7 +32,8 @@ "author": "Arthur Groupp <arth.groupp@gmail.com> (http://groupp.org)",

"devDependencies": {
"chai": "^4.1.1",
"coveralls": "^2.13.1",
"@types/jasmine": "^2.5.53",
"istanbul": "^0.4.5",
"mocha": "^3.5.0"
"jasmine": "^2.7.0",
"typescript": "^2.4.2"
}
}

@@ -8,3 +8,5 @@ # email-syntax

Syntax email addresses verification based on [RFC5321](https://tools.ietf.org/html/rfc5321) and
[RFC5322](https://tools.ietf.org/html/rfc5322).
[RFC5322](https://tools.ietf.org/html/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.

@@ -19,8 +21,11 @@

## Usage
To use validator, you need to create instance of EmailSyntax class and use its main method validate(). Furthermore,
you can use method extractFromQuotes() to get local part of address without quotes.
Usage of validator is simple as 2 + 2. You need to import class and then use its "validate()" method.
### Node.js
```javascript
const emailSyntax = new EmailSyntax();
if (emailSyntax.validate('test@some-mail.com')){
const EmailSyntax = require('email-syntax').EmailSyntax;
if (EmailSyntax.validate('test@some-mail.com')){
console.log('This address is valid');

@@ -30,3 +35,13 @@ }

### Angular 2/4
```typescript
import { EmailSyntax } from 'email-syntax';
function isEmailValid(address): boolean{
return EmailSyntax.validate(address);
}
```
## Tests

@@ -33,0 +48,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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