password-generator
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -22,3 +22,3 @@ /* | ||
password = function (length, memorable, pattern, prefix) { | ||
var char, n; | ||
var char = "", n; | ||
if (length == null) { | ||
@@ -36,21 +36,22 @@ length = 10; | ||
} | ||
if (prefix.length >= length) { | ||
return prefix; | ||
} | ||
if (memorable) { | ||
if (prefix.match(consonant)) { | ||
pattern = vowel; | ||
} else { | ||
pattern = consonant; | ||
while (prefix.length < length) { | ||
if (memorable) { | ||
if (prefix.match(consonant)) { | ||
pattern = vowel; | ||
} else { | ||
pattern = consonant; | ||
} | ||
} | ||
n = Math.floor(Math.random() * 94) + 33; | ||
char = String.fromCharCode(n); | ||
if (memorable) { | ||
char = char.toLowerCase(); | ||
} | ||
if (char.match(pattern)) { | ||
prefix = "" + prefix + char; | ||
} | ||
} | ||
n = Math.floor(Math.random() * 94) + 33; | ||
char = String.fromCharCode(n); | ||
if (memorable) { | ||
char = char.toLowerCase(); | ||
} | ||
if (!char.match(pattern)) { | ||
return password(length, memorable, pattern, prefix); | ||
} | ||
return password(length, memorable, pattern, "" + prefix + char); | ||
return prefix; | ||
// return password(length, memorable, pattern, "" + prefix + char); | ||
}; | ||
@@ -57,0 +58,0 @@ |
{ | ||
"name": "password-generator", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Memorable password generator. For the command line, Node.js and the browser.", | ||
@@ -5,0 +5,0 @@ "author": "Bermi Ferrer <bermi@bermilabs.com>", |
@@ -34,4 +34,9 @@ (function (root) { | ||
}); | ||
it('should generate long passwords without throwing exceeding the ' + | ||
'call stack limits' , function () { | ||
var pass = generatePassword(1200, false, /\d/); | ||
expect(pass).to.match(/^\d{1200}$/); | ||
}); | ||
}); | ||
}(this)); |
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
16732
255