hrbu-util
Version:
提供了格式化时间,生成4、6位验证码
34 lines (26 loc) • 561 B
Markdown
## 安装
```
npm install hrbu-util
```
## 导入
```js
const hrbuUtil = require("hrbu-util");
```
## 格式化时间
```js
// 调用 dataFormat 对时间进行格式化
const dtStr = hrbuUtil.dateFormat(new Date());
// 结果 2022-3-24 20:01:33
```
## 4位验证码
```js
// 获取4位字母与数字组成的验证码
const dtStr = hrbuUtil.verificationCode(4);
// 结果 rds7
```
## 6位验证码
```js
// 获取6位字母与数字组成的验证码
const dtStr = hrbuUtil.verificationCode(6);
// 结果 vr9ktc
```