wjn-tooles
v1.0.0
Published
提供了格式化时间,HTMLEscape的功能
Downloads
2
Readme
安装方式
npm install wjn-tooles
导入
const wjn = require('wjn-tooles')
格式化时间
const dt=wjn.dateFormat(new Date())
console.log(dt);//2022-10-29 19:52:00
转义html特殊字符
//待转换的HTML字符串
const htmlStr='<h1 title="abc">这是h1标签<span>123 </span></h1>'
//调用htmlEscape 方法进行转义
const str=wjn.htmlEscape(htmlStr)
console.log(str);//<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>
还原html特殊字符
const str2=wjn.htmlUnEscape(str)
console.log(str2);//<h1 title="abc">这是h1标签<span>123 </span></h1>
开源协议
ISC