# liudongyu-tools

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

Latest version **1.0.1** (published 2022-10-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install liudongyu-tools
pnpm add liudongyu-tools
yarn add liudongyu-tools
bun add liudongyu-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 | 2022-10-04 |
| First published | 2022-10-04 |
| 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 | forrestliuuav |

## Links

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

## Recent versions

- 1.0.1 (latest) — 2022-10-04
- 1.0.0 — 2022-10-04

## README

## 安装
```
npm install liudongyu-tools
```

## 导入

```js
const tools = require('liudongyu-tools')
```

## 格式化时间
```js

// 调用 dateFormat 对时间进行格式化
const dtStr = tools.dateFormat(new Date())

// 打印时间: 2022-10-03 22:12:33
console.log(dtStr)
```



## 转义 HTML 中的特殊字符

```js
// 转义 HTML 
const htmlStr = '<h1 title = "abc">这是h1标签<span>123&nbsp;</span></h1>'
const str = tools.htmlEscape(htmlStr)
// 输出结果：&lt;h1 title = &quot;abc&quot;&gt;这是h1标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
console.log(str)
```




## 还原 HTML 中的特殊字符

```js
// 还原HTML 
const Str = '&lt;h1 title = &quot;abc&quot;&gt;这是h1标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;'
const htmlstr = tools.htmlUnEscape(str)

// 输出结果：<h1 title = "abc">这是h1标签<span>123&nbsp;</span></h1>
console.log(htmlstr)
```

## 开源协议
ISC

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