1.0.0 • Published 2 years ago
itheima-icu v1.0.0
##安装方式
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="我是一个测试">我只是一个测试 </h1>';
const hm = itheima.htmlEscape(str);
// <h1 title="我是一个测试">我只是一个测试&nbsp;&nbsp;</h1>
console.log(hm);
##还原 HTML 中的特殊字符
let hm=<h1 title="我是一个测试">我只是一个测试&nbsp;&nbsp;</h1>
const hm1 = itheima.unhtmlEscape(hm);
// <h1 title="我是一个测试">我只是一个测试 </h1>
console.log(hm1);
##开源协议 ISC
1.0.0
2 years ago