gyc_tools
v1.0.0
Published
格式化时间,HTMLEscape功能
Downloads
4
Readme
安装
npm i gyc-tools
导入
const gyc = require('gyc-tools')
格式化时间
// 调用dateFormat对时间进行格式化
const dtstr = gyc.dateFormat(new Date())
// 结果2022-02-00 16:18:51
console.log(dtstr)
转义HTML中的特殊字符
// 调用htmlEscape方法进行转换
const str = gyc.htmlEscape(hrmlStr)
// 结果<h1 title="abc">这是h1标签<span>这是span标签123 &nbsp;</span></h1>
console.log(str)
还原HTML中的特殊字符
// 调用htmlUnEscape方法进行还原
const str2 = gyc.htmlUnEscape(hrmlStr)
// 结果<h1 title="abc">这是h1标签<span>这是span标签123 </span></h1>
console.log(str2)
开源协议
ISC