1.0.1 • Published 11 months ago

zaobao v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

安装

npm install zaobao

导入

const zaobao = require('zaobao')

格式化时间

//调用 dataFormat 对时间进行格式化
const date = zaobao.dataFormat(new Date());
//结果为:2023-05-28 17:01:43
console.log(date);

转义 HTML 中的特殊字符

//带转换的HTML字符串
const htmlstr = "<h1>666&nbsp;</h1>";
const str = zaobao.htmlEscape(htmlstr);
//结果为:&lth1&gt666&nbsp;&lt/h1&gt
console.log(str);

还原 HTML 中的特殊字符

//待还原的HTML字符串
const html1 = zaobao.htmlUnEscape(str);
//输出的结果:<h1>666&nbsp;</h1>
console.log(html1);

开源协议

ISC

1.0.1

11 months ago

1.0.0

11 months ago