1.0.1 • Published 2 years ago
itheima-tools-huan v1.0.1
安装
npm install itheima-tools-huan
导入
const itheima = require('itheima-tools');
格式化时间
// 调用dateFormat对时间进行格式化
const dtStr = itheima.dateFormat(new date());
// 结果 2022-05-23 10:29:22
console.log(dtStr);
转义HTML中的特殊字符
const str = '<h1 title="abc"><span>我有一头 小毛驴</span>np</h1>';
newStr = itheima.htmlEscape(str);
还原HTML中的特殊字符
newStr2 = itheima.htmlUnEscape(newStr);
开源协议
ISC