1.0.1 • Published 2 years ago
ithepb-tools v1.0.1
安装
npm install ithepb-tools
导入
const ithepb = require('ithepb-tools')
格式化时间格式
const dtStr = ithepb.dataFormat(new Date())
//结果
console.log(dtStr)
转义HTML中的特殊字符
//调用htmlEscape进行转换
const htmlStr = '<h1 title="a">这是h1标签<span>123 </span></h1>'
//结果
console.log(ithepb.htmlEscape(htmlStr));
还原HTML的转义字符
//待还原的字符
const html = ithepb.htmlEscape(htmlStr)
//调用还原转义的方法
const newHtml = ithepb.htmlEscapeHtml(html)
console.log(newHtml)
开源协议
ISC