1.0.0 • Published 2 years ago

zqkch-tools v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

安装

npm i zqkch-tools

导入

const zqk = require("zqkch-tools")

格式化时间

const dataStr = zqk.dateFormat(new Date())
// 结果 2022-1-29 22:37:55
console.log(dataStr);

转义html特殊字符

// 待转换的html字符串
const str = "<h1 style='color:red;'>这是h1<span>我是span&nbsp;</span></h1>"
//调用escape方法进行转换
const htmlstr = zqk.htmlEscape(str)
console.log(htmlstr);

还原html中的特殊字符

//待还原的html字符串
const htmlStr2 = zqk.htmlUnEscape(htmlstr)
//结果
console.log(htmlStr2);

开源协议

ISC