password-generator
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -23,12 +23,12 @@ /* | ||
var char = "", n, i, validChars = []; | ||
if (length == null) { | ||
if (length === null || typeof(length) === "undefined") { | ||
length = 10; | ||
} | ||
if (memorable == null) { | ||
if (memorable === null || typeof(memorable) === "undefined") { | ||
memorable = true; | ||
} | ||
if (pattern == null) { | ||
if (pattern === null || typeof(pattern) === "undefined") { | ||
pattern = /\w/; | ||
} | ||
if (prefix == null) { | ||
if (prefix === null || typeof(prefix) === "undefined") { | ||
prefix = ''; | ||
@@ -35,0 +35,0 @@ } |
@@ -1,16 +0,11 @@ | ||
var argv, fs, optimist, path, puts; | ||
var argv = require('yargs-parser')(process.argv.slice(2)); | ||
fs = require('fs'); | ||
path = require('path'); | ||
puts = console.log; | ||
optimist = require('optimist'); | ||
var puts = console.log; | ||
argv = optimist.usage('Generates a memorable password', { | ||
var options = { | ||
l: { | ||
description: 'Password length', | ||
"default": null | ||
description: 'Password length [default: null]' | ||
}, | ||
c: { | ||
description: 'Generates a non memorable password', | ||
"default": 'memorable' | ||
description: 'Generates a non memorable password [default: "memorable"]' | ||
}, | ||
@@ -23,15 +18,29 @@ p: { | ||
} | ||
}).argv; | ||
}; | ||
this.showHelp = function () { | ||
puts('Generates a memorable password\r\n'); | ||
puts('Options:'); | ||
var keys = Object.keys(options); | ||
keys.forEach(function (key) { | ||
puts(' -' + key + ': ' + options[key].description); | ||
}); | ||
}; | ||
this.run = function () { | ||
var generatePassword = require('./password-generator'), | ||
pattern = argv.p || null; | ||
var MEMORABLE, generatePassword, memorable, pattern; | ||
MEMORABLE = 'memorable'; | ||
generatePassword = require('./password-generator'), | ||
pattern = argv.p || null; | ||
if (argv.h) { | ||
return optimist.showHelp(); | ||
return this.showHelp(); | ||
} | ||
memorable = argv.c || MEMORABLE; | ||
if (pattern) { | ||
pattern = new RegExp(pattern); | ||
argv.c = false; | ||
memorable = false; | ||
} | ||
puts(generatePassword(argv.l, argv.c === 'memorable', pattern)); | ||
}; | ||
puts(generatePassword(argv.l, memorable === MEMORABLE, pattern)); | ||
}; |
@@ -23,12 +23,12 @@ /* | ||
var char = "", n, i, validChars = []; | ||
if (length == null) { | ||
if (length === null || typeof(length) === "undefined") { | ||
length = 10; | ||
} | ||
if (memorable == null) { | ||
if (memorable === null || typeof(memorable) === "undefined") { | ||
memorable = true; | ||
} | ||
if (pattern == null) { | ||
if (pattern === null || typeof(pattern) === "undefined") { | ||
pattern = /\w/; | ||
} | ||
if (prefix == null) { | ||
if (prefix === null || typeof(prefix) === "undefined") { | ||
prefix = ''; | ||
@@ -35,0 +35,0 @@ } |
{ | ||
"name": "password-generator", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Memorable password generator. For the command line, Node.js and the browser.", | ||
@@ -29,3 +29,3 @@ "author": "Bermi Ferrer <bermi@bermilabs.com>", | ||
"dependencies": { | ||
"optimist": "0.6.1" | ||
"yargs-parser": "^8.0.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
23640
19
383
0
+ Addedyargs-parser@^8.0.0
+ Addedcamelcase@4.1.0(transitive)
+ Addedyargs-parser@8.1.0(transitive)
- Removedoptimist@0.6.1
- Removedminimist@0.0.10(transitive)
- Removedoptimist@0.6.1(transitive)
- Removedwordwrap@0.0.3(transitive)