MCPcopy Create free account
hub / github.com/codemistic/Web-Development / generatePassword

Function generatePassword

Radom-password-genrator/main.js:156–170  ·  view source on GitHub ↗
(length, lower, upper, number, symbol)

Source from the content-addressed store, hash-verified

154
155// Function responsible to generate password and then returning it.
156function generatePassword(length, lower, upper, number, symbol) {
157 let generatedPassword = "";
158 const typesCount = lower + upper + number + symbol;
159 const typesArr = [{ lower }, { upper }, { number }, { symbol }].filter(item => Object.values(item)[0]);
160 if (typesCount === 0) {
161 return "";
162 }
163 for (let i = 0; i < length; i++) {
164 typesArr.forEach(type => {
165 const funcName = Object.keys(type)[0];
166 generatedPassword += randomFunc[funcName]();
167 });
168 }
169 return generatedPassword.slice(0, length);
170}
171
172// function that handles the checkboxes state, so at least one needs to be selected. The last checkbox will be disabled.
173function disableOnlyCheckbox(){

Callers 1

main.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected