@sideway/address
Advanced tools
Comparing version 4.1.2 to 4.1.3
@@ -20,2 +20,6 @@ 'use strict'; | ||
if (!domain) { // Catch null / undefined | ||
return Errors.code('DOMAIN_NON_EMPTY_STRING'); | ||
} | ||
if (typeof domain !== 'string') { | ||
@@ -25,6 +29,2 @@ throw new Error('Invalid input: domain must be a string'); | ||
if (!domain) { | ||
return Errors.code('DOMAIN_NON_EMPTY_STRING'); | ||
} | ||
if (domain.length > 256) { | ||
@@ -51,2 +51,8 @@ return Errors.code('DOMAIN_TOO_LONG'); | ||
if (options.allowFullyQualified && | ||
domain[domain.length - 1] === '.') { | ||
domain = domain.slice(0, -1); | ||
} | ||
const minDomainSegments = options.minDomainSegments || internals.minDomainSegments; | ||
@@ -110,2 +116,6 @@ | ||
if (domain.includes('%')) { | ||
domain = domain.replace(/%/g, '%25'); | ||
} | ||
try { | ||
@@ -112,0 +122,0 @@ return new internals.URL(`http://${domain}`).host; |
@@ -182,3 +182,3 @@ 'use strict'; | ||
raw = `(?=.)(?!https?\:/$)${raw}`; // Require at least one character and explicitly forbid 'http:/' | ||
raw = `(?=.)(?!https?\:/(?:$|[^/]))(?!https?\:///)(?!https?\:[^/])${raw}`; // Require at least one character and explicitly forbid 'http:/' or HTTP with empty domain | ||
@@ -185,0 +185,0 @@ return { |
{ | ||
"name": "@sideway/address", | ||
"description": "Email address and domain validation", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"repository": "git://github.com/sideway/address", | ||
@@ -6,0 +6,0 @@ "main": "lib/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
56681
2294