1.0.1 • Published 11 months ago
hxg-tools v1.0.1
安装
npm install hxg-tools --save
导入
const hxgTools = require('hxg-tools')
格式化时间
// 调用dateFormat对时间进行格式化
const dtStr = hxgTools.dateFormat(new Date())
转义HTML中的字符串
//待转换html字符串
const htmlStr = '<h1 title="abc">这是h1标签 <span>123 </span></h1>'
console.log(hxgTools.htmlEscape(htmlStr))
还原HTML 中的特殊字符串
const str = '<h1 title="abc">这是h1标签 <span>123&nbsp;</span></h1>'
console.log(hxgTools.htmlUnEscape(htmlStr))