npm install itty-tools
const itty = require('itty-tools')
itty.dateFormat(new Date('2020-1-1'))
const htmlstr = '<h1 title="abc">这是H1标签<span>123 </span></h1 >'
const newStr = tool.htmlEscape(htmlstr);
// <h1 title="abc">这是H1标签<span>123&nbsp;</span></h1 >
const htmlstr = '<h1 title="abc">这是H1标签<span>123 </span></h1 >'
const newStr = tool.htmlEscape(htmlstr);
const oldStr = tool.htmlUnEscape(newStr);
// <h1 title="abc">这是H1标签<span>123 </span></h1 >
ISC