password_with_constrains
Version:
This will generate random password as per as need
48 lines (41 loc) • 1.06 kB
Markdown
# PASSWORD GENERATOR
This pkg will be responsible to generate the random password with suppled constraints like Upper Case, Lower Case, Numeric Value etc.
## Getting Started and Example
Consider the following example it's simple as that :-
```
const passGenerator = require('password_with_constrains');
const requiredFieldsObject = {
upperCase: {
required: true,
max: 2,
min: 1,
},
lowerCase: {
required: true,
max: 4,
min: 1,
},
specialCharacter: {
required: true,
max: 1,
min: 1,
},
numericValue: {
required: true,
max: 1,
min: 1,
},
};
const MAX_PASS_LENGTH = 9 ;
const MIN_PASS_LENGTH = 6 ;
(async () => {
try {
const password = await passGenerator(MIN_PASS_LENGTH, MAX_PASS_LENGTH, requiredFieldsObject)
console.log(password)
} catch (error) {
console.log(error)
}
})();
```
## Authors
- **Parse Shyam** - (https://github.com/parseshyam)