Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

password-generator

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

password-generator - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

37

lib/password-generator.js

@@ -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));
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc