# xyf-node-utils

> 格式化日期 html特殊字符转换

Latest version **1.0.0** (published 2023-03-22) · 0 weekly downloads

## Install

```sh
npm install xyf-node-utils
pnpm add xyf-node-utils
yarn add xyf-node-utils
bun add xyf-node-utils
```

## 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 | 2023-03-22 |
| First published | 2023-03-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | saraxyf |
| Keywords | xyf, x, xieyufen, 谢, 谢钰芬 |

## Links

- npm: https://www.npmjs.com/package/xyf-node-utils
- npm.io page: https://npm.io/package/xyf-node-utils

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-03-22

## README

### 1.安装
```
npm install xyf-node-utils
```
### 2.导入
```
const utils = require("xyf-node-utils")
```  
### 3.API
#### 3.1日期格式化
```
const dd =  utils.dateFormat(new Date())
//打印 yyyy-MM-dd HH:mm:ss
console.log(dd)     
```    
#### 3.2html转换为转义字符
```
let str =  '<h1 style="color:red;">你好！&copy<span>小黄</span></h1>'
let str2 = utils.htmlEscape(str)
//打印:&lt;h1 style=&quot;color:red;&quot;&gt;你好！&amp;copy&lt;span&gt;小黄&lt;/span&gt;&lt;/h1&gt;
console.log(str2)
```
#### 3.3转义字符转换为html字符
```
let str = '&lt;h1 style=&quot;color:red;&quot;&gt;你好！&amp;copy&lt;span&gt;小黄&lt;/span&gt;&lt;/h1&gt;'
let str2 = utils.htmlUnEscape(str)
//打印:<h1 style="color:red;">你好！&copy<span>小黄</span></h1>
console.log(str2)
```
### 4.开源协议
```
ISC
```

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