2.0.0 • Published 4 years ago

zxheima-tools v2.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

安装

npm install zxheima-tools

导入

const zxheima=require(' zxheima-tools')

格式化时间

//调用dateFormat对时间进行格式化
const time = zxheima.dataFormat(new Date());
//结果 2020-04-03 14:20:25
console.log(time);

转义HTML中的特殊字符

//待转换的HTML字符串
let htmlStr = '<h1></h1>'
//调用htmlEscape方法进行转换
let str = zxheima.htmlEscape(htmlStr);
//转换后的结果
console.log(str);

还原HTML中的特殊字符

//带还原的HTML字符串
let newStr = zxheima.htmlUnEscape(str);
//还原后的结果
console.log(newStr);

开源协议

ISC