1.0.0 • Published 1 year ago
levi-tools v1.0.0
安装
npm install levi-tools
导入
const levi = require('levi-tools')
格式化时间
// 调用dateFormat 对事件格式化
const dtStr = levi.dateFormat(new Date())
console.log(dtStr)
转义HTML中的特殊字符
// 转义HTML中的特殊字符
const htmlStr = '<h1 title="abc">这是h1标签<span>123 </span></h1>'
const str = levi.htmlEscape(htmlStr)
console.log(str);
还原HMTL中的特殊字符
//还原HTML中的特殊字符
const str2 = levi.htmlUnEscape(str);
console.log(str2);
1.0.0
1 year ago