0.0.1 • Published 2 years ago
hxt-tools v0.0.1
安装
npm install hxt-tools
导入
const hxt = require('hxt-tools')
格式化时间
// 调用 dataFormat 对时间进行格式化
const dtStr = hxt.dataFormat(new Date());
// 结果 2022-08-24 18:04:01
console.log(dtStr)
转义 HTML 中的特殊字符
const htmlStr = '<h1 title = "abc">h1标签<span>123 </span></h1>'
const str = hxt.htmlEscape(htmlStr)
console.log(str)
还原 HTML 中的特殊字符
const str2 = hxt.htmlUnEscape(str)
console.log(str2)
开源协议
ISC
0.0.1
2 years ago