1.0.5 • Published 3 years ago

random-rule v1.0.5

Weekly downloads
8
License
ISC
Repository
github
Last release
3 years ago

random-rule

简介

random-rule 是一个使用十分简单按照固定规则生成随机字符串的库

在线demo

在线demo

安装

npm install random-rule --save

使用

/**
 *
 * @param {!Object}
 *
 * @param {Boolean} Object.capitalLetters 是否包含大写字母
 * @param {Boolean} Object.lowercaseLetters 是否包含小写字母
 * @param {Boolean} Object.number 是否包含数字
 * @param {Boolean} Object.symbols 是否包含符号
 * @param {Number} Object.length 生成字符串长度
 *
 * @return string
 */

randomRule({
  capitalLetters: true,
  lowercaseLetters: true,
  number: true,
  symbols: true,
  length: 10
})

// => 'KGRuf^381K'
/**
 *
 * @param {String} 字符串模板,根据该字符串生成长度与数字大小写符号位置商都相对应的随机字符串
 *
 * @return string
 *
 */

randomRule('123qweQWE!@#')

// => '085pnwPNF)^#'
1.0.5

3 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago