hm77777

1.0.0 • Public • Published

安装

    npm install hm777_tools

导入

const hm777 = require('hm777_tools')

格式化时间

// 调用dateFormat对时间进行格式化
const dateStr = hm777.dateFormat(new Date())

转义HTML中特殊字符

const htmlStr = '<h1>Hello!&&"World"</h1>'
hm777.htmlEscape(htmlStr)
// 转换结果:&lt;h1&gt;Hello!&amp;&amp;&quot;World&quot;&lt;/h1&gt;
console.log(htmlStr)

还原HTMl中的特殊字符

// str为待还原的HTML字符串
hm777.htmlUnEscape(str)
// 还原结果:<h1>Hello!&&"World"</h1>
console.log(str)

开源协议

ISC

Readme

Keywords

Package Sidebar

Install

npm i hm77777

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

2.52 kB

Total Files

6

Last publish

Collaborators

  • lwh_7mh