readability tweak

This commit is contained in:
Alex Booker 2015-08-16 09:02:43 +01:00
parent 97f89b7ba2
commit 28803ae0b9

View File

@ -218,34 +218,28 @@
if (options.includePunctuationChars) {
candidates += punct;
}
var result = "";
var password = "";
for (var i = 0; i < options.passwordLength; i++) {
var randomNum = generateRandomNum(candidates.length);
result += candidates.substring(randomNum, randomNum + 1);
password += candidates.substring(randomNum, randomNum + 1);
}
return result;
return password;
};
return {
generatePassword: generatePassword
};
})();
(function() {
'use strict';
function getOptions() {
return {
passwordLength: $("#password-length").val(),
includeUppercaseChars: $("#include-uppercase-chars-checkbox").is(
":checked"),
includeLowercaseChars: $("#include-lowercase-chars-checkbox").is(
":checked"),
includeUppercaseChars: $("#include-uppercase-chars-checkbox").is(":checked"),
includeLowercaseChars: $("#include-lowercase-chars-checkbox").is(":checked"),
includeNumbers: $("#include-digits-checkbox").is(":checked"),
includePunctuationChars: $("#include-special-chars-checkbox").is(
":checked"),
includePunctuationChars: $("#include-special-chars-checkbox").is(":checked"),
}
};
function outputGeneratedPassword() {
var password;
try {
@ -254,9 +248,7 @@
return $("#unsupported-browser-alert").show();
}
if (password === '') {
alert(
"Whops. You unselected all the options. I don't know what characters you want. Click on the button entitled \"Advanced Options\" and enable some options then try again. Nice one"
);
alert("Whops. You unselected all the options. I don't know what characters you want. Click on the button entitled \"Advanced Options\" and enable some options then try again. Nice one");
return;
}
$("#password-input").val(password);