2.0.1 • Published 3 years ago

rand-password v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

rand-password

Description

Generate a random secure password

Instalation

Using npm

npm install rand-password

Using yarn

yarn add rand-password

Example Usage

const { randomPassword } = require('rand-password')

var password = randomPassword()

console.log(password) // .A&,#aG2Yn6M

we can also configure parameters

const { randomPassword } = require('rand-password')

var password = randomPassword({ minLength: 5, maxLength: 20 })

console.log(password) // 2m5aw/,!g[4hhH7

Other ways to use

using async await

const { generatePasswordAsync } = require('rand-password')
const options = { minLength: 8, maxLength: 20 } // options can be null as default

try {
    const password = await generatePasswordAsync(options)
    console.log(password)
} catch (err) {
    // err
}

using promies.then

generatePasswordAsync(options)
    .then(password => console.log(password))
    .catch(err => {
        //err
    })

using a callback

generatePasswordAsync(options, (err, password) => {
    if (err) {
        //err
    }
    console.log('end : ' + password)
})

Parameters

use the parameters generate customised passwords | Option | Description | Default | | --- | --- | --- | | minLength | minimum length of the password | 8 | | maxLength | maximum length of the password | 16 |

License

MIT

2.0.1

3 years ago

2.0.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago