1.0.0 • Published 2 years ago

itheima-icu v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

##安装方式

npm install itheima-icu

##导入方式

const itheima = require("itheima-icu");

##格式化时间

// 调用setTime方法  格式化时间
const time = itheima.setTime(new Date());
// 2021-12-04  21:17:23
console.log(time);

##转义 HTML 中的特殊字符

let str = '<h1 title="我是一个测试">我只是一个测试&nbsp;&nbsp;</h1>';
const hm = itheima.htmlEscape(str);
// &lt;h1 title=&quot;我是一个测试&quot;&gt;我只是一个测试&amp;nbsp;&amp;nbsp;&lt;/h1&gt;
console.log(hm);

##还原 HTML 中的特殊字符

let hm=&lt;h1 title=&quot;我是一个测试&quot;&gt;我只是一个测试&amp;nbsp;&amp;nbsp;&lt;/h1&gt;
const hm1 = itheima.unhtmlEscape(hm);
// <h1 title="我是一个测试">我只是一个测试&nbsp;&nbsp;</h1>
console.log(hm1);

##开源协议 ISC