# zky-tools

> 提供了格式化时间、HTMLEscape相关的功能

Latest version **1.0.0** (published 2020-09-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install zky-tools
pnpm add zky-tools
yarn add zky-tools
bun add zky-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.0 |
| Published | 2020-09-02 |
| First published | 2020-09-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | zoukunyang |

## Links

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

## Recent versions

- 1.0.0 (latest) — 2020-09-02

## README

## 安装方式
```
npm install zky-tools
```
## 导入方式
```js
const zky = require('zky-tools')
```
## 格式化时间的方式
```js
const datestr = zky.dateFormat(new Date())
console.log(datestr);
//结果 2020-09-02 17:50:49
```
## 转义HTML中的特殊字符
```js
// 待转换的 HTML 字符串
const strhtml = '<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>'
// 调用 htmlEscape 方法进行转换
const res = zky.htmlEscape(strhtml)
console.log(res)
//结果 &lt;h1 title=&quot;abc&quot;&gt;这是h1标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
```
## 还原成HTML特殊字符
```js
//待还原的字符 调用htmlUnEscape方法进行转换
const rest = zky.htmlUnEscape(res)
console.log(rest)
//结果 <h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>
```
## 开源协议
ISC

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