# swzdk_myfirstpackage

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

Latest version **1.0.0** (published 2022-06-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install swzdk_myfirstpackage
pnpm add swzdk_myfirstpackage
yarn add swzdk_myfirstpackage
bun add swzdk_myfirstpackage
```

## 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 | 2022-06-04 |
| First published | 2022-06-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | swzdk |
| Maintainers | swzdk |
| Keywords | dateFormat, escape |

## Links

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

## 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.0 (latest) — 2022-06-04

## README

##安装
```
npm install swzdk_myfirstpackage
```

##引用
``` JS
const sm = require('swzdk_myfirstpackage');
```

##格式化时间
```JS
// 调用dateFormat对时间进行格式化
const dtStr = sm.dateFormat(new Date());

// 得到结果_2022-06-04 11:40:29
console.log(dtStr);
```

##转义html（普通）
```JS
// 待转换的html字符串
const htmlStr = '<h1>我是一个h1标签</h1>';

// 调用htmlEscapenm对html格式文件进行转义
const str = sm.htmlEscapenm(htmlStr);

// 得到结果
console.log(str);//&lt;h1&gt;我是一个h1标签&lt;/h1&gt;
```

##转义html（对模板字符串使用）
```JS

// 调用htmlEscapenm对模板字符串进行转义
const str1 = '<li>苹果</li>';
const str2 = '<li>香蕉</li>';
const str3 = '<li>西瓜</li>';
const str = sm.htmlEscapefs
    `<ul>
        ${str1}
        ${str2}
        ${str3}
     </ul>`;
console.log(str);
/* 
    得到结果
    <ul>
        &lt;li&gt;苹果&lt;/li&gt;
        &lt;li&gt;香蕉&lt;/li&gt;
        &lt;li&gt;西瓜&lt;/li&gt;
    </ul>
*/
```

##还原html
```JS
// 待还原的字符串
const htmlStr = `
            <ul>
                &lt;li&gt;苹果&lt;/li&gt;
                &lt;li&gt;香蕉&lt;/li&gt;
                &lt;li&gt;西瓜&lt;/li&gt;
            </ul>`;

// 调用htmlUnEscapenm对转义后的html字符进行还原
const str = sm.htmlUnEscapenm(htmlStr);

console.log(str);
/* 
    得到结果
    <ul>
        <li>苹果</li>
        <li>香蕉</li>
        <li>西瓜</li>
    </ul>
*/
```


##开源协议

ISC

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