1.0.0 • Published 1 year ago
itty-tools v1.0.0
安装
npm install itty-tools
导入
const itty = require('itty-tools')
格式化时间
itty.dateFormat(new Date('2020-1-1'))
转移html中特殊字符
const htmlstr = '<h1 title="abc">这是H1标签<span>123 </span></h1 >'
const newStr = tool.htmlEscape(htmlstr);
// <h1 title="abc">这是H1标签<span>123&nbsp;</span></h1 >
还原html中被转移的字符
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
1.0.0
1 year ago