itheima_wm

1.0.0 • Public • Published

安装

npm i itheima_wm

##导入

const itheima = require('./index')

格式化时间

// 调用 dateFormat 对时间进行格式化
const date = itheima.dateFormat(new Date())
console.log(date);
//结果  2022-09-21  09-35-39

转译HTML中的特殊字符

const str = '<h4 title="abc">这是h4标签<span>123&nbsp;</span></h4>'

const htmlstr = itheima.htmlEscape(str)

console.log(htmlstr);
// 结果 &lt;h4 title=&quot;abc&quot;&gt;这是h4标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h4&gt;

还原 HTML 中的特殊字符

const str1 = '&lt;h4 title=&quot;abc&quot;&gt;这是h4标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h4&gt;'
const res = itheima.htmlUnEscape(str1)
console.log(res);

开源协议

ISC

Readme

Keywords

Package Sidebar

Install

npm i itheima_wm

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

3.06 kB

Total Files

7

Last publish

Collaborators

  • wangmeng99