npm install edison-tools
const edison-tools = require('edison-tools')
//调用 dateFormat 对时间进行格式化
const newDate = edison-tools.dateFormat(new Date())
console.log(newDate);
//结果 2023-11-04 21:48:06
//定义待转义的字符串
const htmlStr = '<h1 title="abc">这是h1标签<span>123 </sapn></h1>'
//调用 htmlEscape 对字符串进行转义
const newHtml = edison-tools.htmlEscape(htmlStr)
console.log(newHtml);
//结果 <h1 title="abc">这是h1标签<span>123&nbsp;</sapn></h1>
//定义待转义的字符串
const htmlStr = '<h1 title="abc">这是h1标签<span>123 </sapn></h1>'
//调用 htmlUnEscape 对字符串进行还原
const newHtml = zhang_tools.htmlUnEscape(htmlStr)
console.log(newHtml);
//结果 <h1 title="abc">这是h1标签<span>123 </sapn></h1>
ISC