isemail
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -24,9 +24,5 @@ // Code shows a string is valid, | ||
* | ||
* The callback function will always be called | ||
* with the result of the operation. | ||
* | ||
* ``` | ||
* ``` | ||
* import * as IsEmail from "isemail"; | ||
* | ||
* const log = result => console.log(`Result: ${result}`); | ||
* IsEmail.validate("test@e.com"); | ||
@@ -41,5 +37,2 @@ * // => true | ||
* | ||
* The callback function will always be called | ||
* with the result of the operation. | ||
* | ||
* ``` | ||
@@ -57,5 +50,2 @@ * import * as IsEmail from "isemail"; | ||
* | ||
* The callback function will always be called | ||
* with the result of the operation. | ||
* | ||
* ``` | ||
@@ -62,0 +52,0 @@ * import * as IsEmail from "isemail"; |
@@ -170,14 +170,23 @@ 'use strict'; | ||
internals.normalizeSupportsNul = '\0'.normalize('NFC') === '\0'; | ||
// $lab:coverage:off$ | ||
internals.nulNormalize = function (email) { | ||
let emailPieces = email.split('\u0000'); | ||
emailPieces = emailPieces.map((string) => { | ||
return email.split('\0').map((part) => part.normalize('NFC')).join('\0'); | ||
}; | ||
// $lab:coverage:on$ | ||
return string.normalize('NFC'); | ||
}); | ||
return emailPieces.join('\u0000'); | ||
internals.normalize = function (email) { | ||
// $lab:coverage:off$ | ||
if (!internals.normalizeSupportsNul && email.indexOf('\0') >= 0) { | ||
return internals.nulNormalize(email); | ||
} | ||
// $lab:coverage:on$ | ||
return email.normalize('NFC'); | ||
}; | ||
// $lab:coverage:on$ | ||
@@ -235,2 +244,4 @@ | ||
// The callback function is deprecated. | ||
// $lab:coverage:off$ | ||
if (typeof options === 'function') { | ||
@@ -244,2 +255,3 @@ callback = options; | ||
} | ||
// $lab:coverage:on$ | ||
@@ -1316,5 +1328,7 @@ let diagnose; | ||
// $lab:coverage:off$ | ||
if (callback) { | ||
callback(finishResult); | ||
} | ||
// $lab:coverage:on$ | ||
@@ -1338,12 +1352,2 @@ return finishResult; | ||
exports.normalize = internals.normalize = function (email) { | ||
// $lab:coverage:off$ | ||
if (process.version[1] === '4' && email.indexOf('\u0000') >= 0) { | ||
return internals.nulNormalize(email); | ||
} | ||
// $lab:coverage:on$ | ||
return email.normalize('NFC'); | ||
}; | ||
exports.normalize = internals.normalize; |
{ | ||
"name": "isemail", | ||
"description": "Validate an email address according to RFCs 5321, 5322, and others", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"repository": "git://github.com/hapijs/isemail", | ||
"files": [ | ||
"lib/" | ||
], | ||
"main": "lib/index.js", | ||
@@ -7,0 +10,0 @@ "types": "lib/index.d.ts", |
66347
5
1202