1.0.0 • Published 2 years ago
itheima-tools-freddy v1.0.0
##安装
npm install itheima-tools-freddy
##导入
const itheima = require("itheima-tools");
##格式化时间
const dtStr = itheima.dateFormat(new Date());
// 结果 2022-02-15,21:28:00
console.log(dtStr);
const str = "<h1>这是个测试字段</h1>";
const htmlStr = itheima.htmlEscape(str);
// 结果 <h1>这是个测试字段</h1>
console.log(htmlStr);
##还原 HTML 中的特殊字符
const str = "<h1>这是个测试字段</h1>";
const htmlStr = itheima.htmlUnEscape(str);
// 结果 <h1>这是个测试字段</h1>
console.log(htmlStr);
1.0.0
2 years ago