1.0.0 • Published 1 year ago

levi-tools v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

安装

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&nbsp;</span></h1>'
const str = levi.htmlEscape(htmlStr)
console.log(str);

还原HMTL中的特殊字符

//还原HTML中的特殊字符
const str2 = levi.htmlUnEscape(str);
console.log(str2);