npm install tools-ysh
const text = require("./tools-ysh");
// 调用时间方法
const timeStr = text.dateFormat(new Date());
// 结果 2021-05-18 10:36:41
console.log(timeStr);
// 标签变量
const str = '<h1 title="abc">这是h1标签<span>123 </span></h1>';
// 调用转义 HTML 的方法
const htmlStr = text.htmlEscape(str);
// 结果 <h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>
console.log(htmlStr);
// 调用还原 HTML 的方法
const htmlStr2 = text.htmlUnEscape(htmlStr);
// 结果 <h1 title="abc">这是h1标签<span>123 </span></h1>
console.log(htmlStr2);
ISC