one-validation
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -14,3 +14,3 @@ { | ||
"description": "Regexp based validation collection for common internet validation tasks", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"repository": { | ||
@@ -17,0 +17,0 @@ "url": "git://github.com/One-com/one-validation.git" |
@@ -23,2 +23,26 @@ /*global beforeEach, describe, it*/ | ||
}); | ||
it('should disallow underscore in domain with no subdomain', function () { | ||
expect('_example.com', 'not to pass'); | ||
}); | ||
it('should disallow underscore in domain with valid subdomain', function () { | ||
expect('_sub._example.com', 'not to pass'); | ||
}); | ||
it('should allow underscore at start of subdomain', function () { | ||
expect('_sub.example.com', 'to pass'); | ||
}); | ||
it('should allow underscore in middle of subdomain', function () { | ||
expect('sub_domain.example.com', 'to pass'); | ||
}); | ||
it('should allow underscore in end of subdomain', function () { | ||
expect('sub_.example.com', 'to pass'); | ||
}); | ||
it('should allow underscore in multiple subdomains', function () { | ||
expect('_sub1.sub_2.sub3_.example.com', 'to pass'); | ||
}); | ||
}); | ||
@@ -25,0 +49,0 @@ |
@@ -41,2 +41,3 @@ /*global module, define*/ | ||
visibleAsciiChar: /[\x20-\x7e]*/, | ||
subDomainPart: /[_a-z0-9](?:[_\-a-z0-9]*[_a-z0-9])?/i, | ||
domainPart: /[a-z0-9](?:[\-a-z0-9]*[a-z0-9])?/i, | ||
@@ -72,3 +73,3 @@ tld: /[a-z][\-a-z]*[a-z]/i, | ||
fragments.domain = fragments.domainName = new RegExp('(?:' + fragments.domainPart.source + '\\.)+' + fragments.tld.source, 'i'); | ||
fragments.domain = fragments.domainName = new RegExp('(?:' + fragments.subDomainPart.source + '\\.)*' + '(?:' + fragments.domainPart.source + '\\.)+' + fragments.tld.source, 'i'); | ||
fragments.domainIdn = fragments.domainNameIdn = new RegExp('(?:' + fragments.domainPartIdn.source + '\\.)+' + fragments.tldIdn.source, 'i'); | ||
@@ -75,0 +76,0 @@ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
29909
365
11
1