1.0.6 • Published 4 years ago
ts-password-generator v1.0.6
Password Generator Module
A little module to generate password, use fromCharCode() static method to convert a random "ASCII - Unicode" code to a readable character.
String.fromCharCode()Feel free to use it, if you like it! :D
Ready to use
Just npm install ts-password-generator, then
import { generator } from 'ts-password-generator';
const password: string = generator({ haveNumbers: true })or
const tsPasswordGenerator = require("ts-password-generator");
const tsPass = tsPasswordGenerator;
tsPass.generator({});and you are ready to go.
The generator method receive following optional params:
{
charsQty: number,
isUppercase: boolean,
haveNumbers: boolean,
haveString: boolean,
haveSymbols: boolean
}and returns a brand new password string.
Accepted params by generator method
Any of these can be passed into the options object for generator method.
| Name | Description | Default Value |
|---|---|---|
| charsQty | Integer, optional param, password length (chars quantity). | 10 |
| isUppercase | Boolean, optional param, add uppercase chars to the generated password. | false |
| haveNumbers | Boolean, optional param, add numbers to the generated password. | false |
| haveString | Boolean, optional param, add char to the generated password. | true |
| haveSymbols | Boolean, optional param, add symbols (special characters) to the generated password | false |
NOTE: by default, if you don't pass any parameter to the generator method, the generated password will be in lowercase.
TODO
- Add maybe more fuctionality.
DONE
- Make this little script an npm package just for fun, and educative purposes.
- Added more documentation.