simplepass-js
Version:
Library generates passwords
34 lines (18 loc) • 1.24 kB
Markdown
[](https://badge.fury.io/js/simplepass-js)
`npm install simplepass-js`
## How to use
#### Import the module:
`import Password from 'simplepass-js'`
#### Generate a password:
`Password.generate(passwordLength, allowNumbers, specialCharactersLevel)`
`passwordLength` - *{Number}*: password length. The default password length is 8.
`allowNumbers` - *{Boolean}*: allow to contain numbers.
`specialCharacters` - *{Number, possible values: __0-3__}*: allow to contain a special characters.
`specialCharacters = 0`- no special characters.
`specialCharacters = 1` - allow to contain a regular special characters like a `!@#$%^&*`.
`specialCharacters = 2` - allow to contain a non-regular special characters like a `×·∗÷`.
`specialCharacters = 3` - allow to contain a non-regular special characters like a `ɲŋʈɖɟɢʔɨʉɯ`.
### Examples:
`Password.generate(8, 0, 0)` will generate a 8-character password without numbers and special chars.
`Password.generate(8, 1, 0)` will generate a 8-character password which contain numbers and without special chars.
`Password.generate(8, 1, 1)` will generate a 8-character password with numbers and regular special chars.