@zootools/email-spell-checker
Advanced tools
Comparing version 1.8.0 to 1.8.1
@@ -6,13 +6,16 @@ "use strict"; | ||
// http://en.wikipedia.org/wiki/Email_address#Syntax | ||
// | ||
// We have to replace all the possible characters. | ||
// that's why we use a regex with a global flag. | ||
function encodeEmail(email) { | ||
const result = encodeURI(email) | ||
.replace('%20', ' ') | ||
.replace('%25', '%') | ||
.replace('%5E', '^') | ||
.replace('%60', '`') | ||
.replace('%7B', '{') | ||
.replace('%7C', '|') | ||
.replace('%7D', '}'); | ||
.replace(/%20/g, ' ') | ||
.replace(/%25/g, '%') | ||
.replace(/%5E/g, '^') | ||
.replace(/%60/g, '`') | ||
.replace(/%7B/g, '{') | ||
.replace(/%7C/g, '|') | ||
.replace(/%7D/g, '}'); | ||
return result; | ||
} | ||
exports.default = encodeEmail; |
@@ -0,2 +1,7 @@ | ||
/** | ||
* Just in case a browser doesn't support .trim | ||
* Copied from https://github.com/Trott/trim | ||
* Credits to them | ||
*/ | ||
declare function trim(str: string): string; | ||
export default trim; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const WHITESPACE_PATTERN = /\s/; | ||
/** | ||
* Just in case a browser doesn't support .trim | ||
* Copied from https://github.com/Trott/trim | ||
* Credits to them | ||
*/ | ||
function trim(str) { | ||
// trim() not exist in old IE! | ||
return str.replace(/^\s*/, '').replace(/\s*$/, ''); | ||
if (str.trim) { | ||
return str.trim(); | ||
} | ||
return right(left(str)); | ||
} | ||
function left(str) { | ||
if (str.trimLeft) | ||
return str.trimLeft(); | ||
return str.replace(/^\s\s*/, ''); | ||
} | ||
function right(str) { | ||
if (str.trimRight) | ||
return str.trimRight(); | ||
let i = str.length; | ||
while (WHITESPACE_PATTERN.test(str.charAt(--i))) | ||
; | ||
return str.slice(0, i + 1); | ||
} | ||
exports.default = trim; |
{ | ||
"private": false, | ||
"name": "@zootools/email-spell-checker", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "mailSpellChecker.js (mail spell checker) is a lightweight module that suggests a right domain when your users misspell it in an email address", | ||
@@ -6,0 +6,0 @@ "main": "./dist/index.js", |
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
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
33423
630