email-syntax
Advanced tools
Comparing version 1.0.0 to 2.0.0
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16067
13
48
5
207
1