2.0.0 • Published 3 years ago
itheima-hai v2.0.0
##安装
npm install itheima-hai##导入
const itheima=reuqire('itheima-hai');##格式化时间
// 调用gTime对时间进行格式化
const daStr=const o = m.gTime(new Date());
// 结果 2022-11-03 21 :03 :34
console.log(o);##转义HTML中的特殊字符
//待转换的HTML字符串
const htmer = '<h1 title="abc">这是h1标签<span> </span></h1>';
// 调用htmlEcmp方法 进行转换
const tier = m.htmlEcmp(htmer);
//转换的结果<h1 title="abc">这是h1标签<span>undefinednbsp</span></h1>
console.log(tier);##还原HTML中的字符转义
const htmll = m.htmlEspese(tier);
//转换结果: <h1 title="abc">这是h1标签<span>undefinednbsp</span></h1>
console.log(htmll);##开源协议 ISC
2.0.0
3 years ago