UNPKG

node-password-generator

Version:

A simple lightweight npm library for password generator. It allows you to create random unqiue password on the fly.

33 lines (32 loc) 792 B
import generate from "./generate"; export default class SimplePasswordGenerator { /** * @constructor * @param {Object} [options] generator options. */ constructor(options) { this.options = options; } /** * Function, which will generate the password based on provided options. * * @return {string} Genrated result. * * @example * * const options = { * uppercase: false, * lowercase: true, * numbers: true, * symbols: false, * length: 10 * }; * * const generator = new SimplePasswordGenerator(options); * * generator.generatePassword(); //=> mystrongpassword */ generatePassword(options) { return generate({ ...this.options, ...options }); } }