generate-password

2019-12-03

generate-password是什么

什么是generate-password,Easy library for generating unique passwords.

generate-password使用教程帮助文档

Generate Password Build Status codecov

Generate-Password NPM

Generate Password is a (relatively) extensive library for generating random and unique passwords.

Install

$ npm install generate-password --save

Usage

generate([options])

Generate one password with the given options. Returns a string.

var generator = require('generate-password');

var password = generator.generate({
    length: 10,
    numbers: true
});

// 'uEyMTw32v9'
console.log(password);

generateMultiple(amount[, options])

Bulk generate multiple passwords at once, with the same options for all. Returns an array.

var generator = require('generate-password');

var passwords = generator.generateMultiple(3, {
    length: 10,
    uppercase: false
});

// [ 'hnwulsekqn', 'qlioullgew', 'kosxwabgjv' ]
console.log(passwords);

Available options

Any of these can be passed into the options object for each function.

Name Description Default Value
length Integer, length of password. 10
numbers Boolean, put numbers in password. false
symbols Boolean, put symbols in password. false
uppercase Boolean, use uppercase letters in password. true
excludeSimilarCharacters Boolean, exclude similar chars, like 'i' and 'l'. false
exclude String, characters to be excluded from password. ''
strict Boolean, password must include at least one character from each pool. false

上一篇:开发期间的API代理
下一篇:Vue打包优化之code spliting-02
相关文章

首次访问,人机识别验证

扫描下方二维码回复 1024 获取验证码,验证完毕后 永久 无须验证

操作步骤:[打开微信]->[扫描上侧二维码]->[关注 FedJavaScript 的微信] 输入 1024 获取验证码

验证码有误,请重新输入