1.0.0 • Published 2 years ago

cqu-tools v1.0.0

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

##安装

npm install cqu-tools

##导入

const cqu=require('cqu-tools')

##格式化时间

//调用dateFormat 对时间进行格式化
const dateStr = cqu.dateFormat(new Date());
//结果  2022-05-01 13:12:20
console.log(dateStr);

转义 HTML 中的特殊字符

//带转换的HTML字符串
const htmlstr = '<h1>这是一个h1标签</h1>'
//调用htmlEscape方法进行转换
const CQ = cqu.htmlEscape(htmlstr);

##还原html中的特殊字符

//待还原的HTML字符串
const strun = cqu.htmlUnEscape(CQ);
//输出的结果
console.log(strun);

##开源协议 ISC