# zhy-tools

> 提供了格式化时间，HTMLEscape的功能

Latest version **1.0.1** (published 2023-03-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install zhy-tools
pnpm add zhy-tools
yarn add zhy-tools
bun add zhy-tools
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-03-01 |
| First published | 2023-03-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 左中秋 |
| Maintainers | zuozhongqiu |
| Keywords | zhy, dateFormat, escape |

## Links

- npm: https://www.npmjs.com/package/zhy-tools
- npm.io page: https://npm.io/package/zhy-tools

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-03-01

## README

## 安装
```js
npm install zhy-tools
```

## 导入
```js
const tools = require('zhy-tools')
```

## 格式化时间
```js
// 调用 dateFormat 对时间进行格式化
const timer = new Date()
const dates = tools.dateFormat(timer)
// 结果 2023-03-01 16:10:53
console.log(dates)
```

## 转义 HTML 中的特殊符号
```js
// 原始数据
const htmlStr = '<h1 title="abc">我是H1标签<span>我在span标签里面&nbsp</span><h1/>'
// 调用 htmlEscape 方法进行转换
const newstr = tools.htmlEscape(htmlStr)
// 转换结果 &lt;h1 title=&quot;abc&quot;&gt;我是H1标签&lt;span&gt;我在span标签里面&amp;nbsp&lt;/span&gt;&lt;h1/&gt;
console.log(newstr)
```

## 还原 HTML 中的特殊字符
```js
// 调用 htmlUnEscape 方法进行转换
const newstr = tools.htmlUnEscape(htmlStr)
// 转换结果 <h1 title="abc">我是H1标签<span>我在span标签里面&nbsp</span><h1/>
console.log(newstr)
```

## 开源协议
ISC

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