hwc-tools

1.0.0 • Public • Published

安装

npm i HWC-tools

导入

const tools = require('hwc-tools')

格式化时间

const time = abc.dataFormate(new Date())
console.log(time);

转义HTML 特殊字符

const htmlStr = '<h1 title="abc">我是你爹</h1>'
// 转义为字符编码
let str = abc.htmlEscape(htmlStr)
// &lt;h1 title=&quot;abc&quot;&gt;我是你爹&lt;/h1&gt;

转回 HTML 格式

const htmlStr = '<h1 title="abc">我是你爹</h1>'
// 转义为字符编码
let str = abc.htmlEscape(htmlStr)
// &lt;h1 title=&quot;abc&quot;&gt;我是你爹&lt;/h1&gt;
// 转义回html
 str = abc.unEscapeHtml(str)
 //<h1 title="abc">我是你爹</h1> 

开源协议

ISC

Readme

Keywords

Package Sidebar

Install

npm i hwc-tools

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

2.29 kB

Total Files

5

Last publish

Collaborators

  • wincheshe