excape-tools
v1.0.0
Published
提供了格式化时间,HTMLEscape相关的功能
Downloads
3
Readme
安装
npm install excape-tools
导入
const excape = require('excape-tools')
格式化时间
const str = dateForm.dateFormat(new Date())
console.log(str);
//结果是 2022年01月21日 20:12:11
转义 HTML 中的特殊字符
///调用htmlEscape方法
const aee = '<hi>wo"djhs"dzxj</hi>'
const a = dateForm.htmlEscape(aee);
console.log(a);
//输出结果是 <hi>wo"djhs"dzxj</hi>
还原 HTML 中的特殊字符
///调用unHtmlEscape方法
const sbb = '<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>'
const b = dateForm.unHtmlEscape(sbb);
console.log(b);
//输出结果为 <h1 title="abc">这是h1标签<span>123 </span></h1>
开源协议
ISC