# @chenbz/utils

> 工具类

Latest version **1.0.12** (published 2022-10-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @chenbz/utils
pnpm add @chenbz/utils
yarn add @chenbz/utils
bun add @chenbz/utils
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.12 |
| Published | 2022-10-26 |
| First published | 2022-03-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | chenbz |
| Maintainers | chenbz |

## Links

- npm: https://www.npmjs.com/package/@chenbz/utils
- Repository: https://github.com/chenbz777/npm-utils
- Issues: https://github.com/chenbz777/npm-utils/issues
- npm.io page: https://npm.io/package/@chenbz/utils

## Recent versions

- 1.0.12 (latest) — 2022-10-26
- 1.0.11 — 2022-10-26
- 1.0.10 — 2022-10-26
- 1.0.9 — 2022-10-26
- 1.0.8 — 2022-10-26
- 1.0.7 — 2022-10-09
- 1.0.6 — 2022-10-09
- 1.0.5 — 2022-04-05
- 1.0.4 — 2022-03-29
- 1.0.3 — 2022-03-29
- 1.0.2 — 2022-03-29
- 1.0.1 — 2022-03-29
- 1.0.0 — 2022-03-29

## README

## 安装

```bash
npm i @chenbz/utils
```

<br />

## 使用

```js
const { date, random, cache: Cache } = require("@chenbz/utils");

// 2022-03-29 12:00:00
console.log(date.getDateTime());

// D7fzbsOma9Wreqgf
console.log(random.str());

const cache = new Cache()
cache.set('name', 123);
console.log(cache.get('name'));  // 123
```



## 介绍

### date

| 函数名              | 描述                             |
| ------------------- | -------------------------------- |
| getDateToString()   | 日期格式化                       |
| getTimeDifference() | 计算两个时间相差的               |
| getDateTime()       | 获取日期时间 yyyy-MM-dd hh:mm:ss |
| getDate()           | 获取日期                         |
| getTime()           | 获取时间                         |
| getTimestamp()      | 获取时间戳（毫秒级）             |
| getTimestamp10()    | 获取时间戳（秒级）               |
| getDateShuttle()    | 获取指定时间前进后退             |

### random

| 函数名                 | 描述                     |
| ---------------------- | ------------------------ |
| random()               | 随机函数                 |
| number()               | 随机数字                 |
| lowerCase()            | 随机小写                 |
| UpperCase()            | 随机大写                 |
| lowerUpperCase()       | 随机大小写               |
| numberLowerCase()      | 随机数字和小写           |
| numberUpperCase()      | 随机数字和大写           |
| numberLowerUpperCase() | 随机数字和大小写         |
| str()                  | 随机数字和大小写(简写版) |



### cache

| 函数名   | 描述                              |
| -------- | --------------------------------- |
| set()    | 赋值(标识, 值, 过期时间 => 单位s) |
| get()    | 获取(标识)                        |
| has()    | 判断是否存在(标识)                |
| delete() | 删除(标识)                        |
| size()   | 获取长度                          |
| list()   | 获取所有值                        |

---
_Source: https://npm.io/package/@chenbz/utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
