1.0.0 • Published 3 years ago

zxh-tools v1.0.0

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

说明文档:一般包含6项内容:安装方式、导入方式、格式化时间、转义HTML中的特殊字符、还原HTML中的特殊字符、开源协议

安装

npm install zxh-tools

导入

const zxh = require('zxh-tools');

格式化时间

// 调用dateFormat格式化时间
const date = new Date();
console.log(zxh.dateFormat(date));

转义HTML中的特殊字符

const HTMLStr = '<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>';
const str = zxh.htmlEscape(HTMLStr);
console.log(str);

还原HTML中的特殊字符

const unStr = zxh.htmlUnEscape(str);
console.log(unStr);

开源协议

ISC