npm-user-validate
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -7,2 +7,3 @@ exports.email = email | ||
username: { | ||
length: 'Name length must be less than or equal to 576 characters long', | ||
lowerCase: 'Name must be lowercase', | ||
@@ -31,2 +32,6 @@ urlSafe: 'Name may not contain non-url-safe chars', | ||
if (un.length > 576) { | ||
return new Error(requirements.username.length) | ||
} | ||
return null | ||
@@ -33,0 +38,0 @@ } |
{ | ||
"name": "npm-user-validate", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "User validations for npm", | ||
@@ -5,0 +5,0 @@ "main": "npm-user-validate.js", |
@@ -5,3 +5,3 @@ var test = require('tap').test | ||
test('username must be lowercase', function (t) { | ||
err = v('ERRR') | ||
var err = v('ERRR') | ||
t.type(err, 'object') | ||
@@ -13,3 +13,3 @@ t.match(err.message, /lowercase/) | ||
test('username may not contain non-url-safe chars', function (t) { | ||
err = v('f ') | ||
var err = v('f ') | ||
t.type(err, 'object') | ||
@@ -21,3 +21,3 @@ t.match(err.message, /url-safe/) | ||
test('username may not start with "."', function (t) { | ||
err = v('.username') | ||
var err = v('.username') | ||
t.type(err, 'object') | ||
@@ -28,6 +28,19 @@ t.match(err.message, /start with.*\./) | ||
test('username may not be longer than 576 characters', function (t) { | ||
var err = v('bacon-ipsum-dolor-amet-tongue-short-loin-landjaeger-tenderloin-ball-tip-pork-loin-porchetta-pig-pork-chop-beef-ribs-pork-belly--shankle-t-bone-turducken-tongue-landjaeger-pork-loin-beef-chicken-short-loin-venison-capicola--brisket-leberkas-pork-beef-ribs-kevin-short-ribs-tail-bresaola-ham--rump-fatback-short-ribs-frankfurter-boudin--turkey-cupim-tri-tip-pork-chop-landjaeger-frankfurter-ham-hock---kielbasa-sausage-sirloin-short-loin-bacon-tenderloin-biltong-spare-ribs-cow-beef-ribs-tongue-cupim-filet-mignon-drumstick--pork-chop-tenderloin-brisket-pork-belly-leberkas-and-a-pickle') | ||
t.type(err, 'object') | ||
t.match(err.message, /less than or equal to 576/) | ||
t.end() | ||
}); | ||
test('username may be as long as 576 characters', function (t) { | ||
var err = v('bacon-ipsum-dolor-amet-tongue-short-loin-landjaeger-tenderloin-ball-tip-pork-loin-porchetta-pig-pork-chop-beef-ribs-pork-belly--shankle-t-bone-turducken-tongue-landjaeger-pork-loin-beef-chicken-short-loin-venison-capicola--brisket-leberkas-pork-beef-ribs-kevin-short-ribs-tail-bresaola-ham--rump-fatback-short-ribs-frankfurter-boudin--turkey-cupim-tri-tip-pork-chop-landjaeger-frankfurter-ham-hock---kielbasa-sausage-sirloin-short-loin-bacon-tenderloin-biltong-spare-ribs-cow-beef-ribs-tongue-cupim-filet-mignon-drumstick--pork-chop-tenderloin-brisket-pork-belly-leberkas-beef') | ||
t.type(err, 'null') | ||
t.end() | ||
}); | ||
test('username is ok', function (t) { | ||
err = v('ente') | ||
var err = v('ente') | ||
t.type(err, 'null') | ||
t.end() | ||
}) |
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
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
6458
127
0