lishijie
v1.0.0
Published
提供格式化时间,HTMLEscape相关的功能
Downloads
5
Maintainers
Readme
安装
npm install lishijie导入
const lsj = require('lishijie');格式化时间
// 调用 dateFormat 对时间进行格式化
const date = lsj.dateFormat(new Date());
// 输出的结果:2020-12-06 20:51:51
console.log(date);转义 HTML 中的特殊字符
// 待转换的 HTML 字符
const str1 = '<h1 style="">哈哈哈&nbps;<span></span></h1>';
// 调用 HTMLEscape 方法进行转换
const m1 = lsj.HTMLEscape(str1);
// 转换的结果:<h1 style="">哈哈哈&nbps;<span></span></h1>
console.log(m1);还原特殊字符
// 待还原的 HTML 字符
const m2 = lsj.HTMLUnEscape(m1);
// 还原的结果:<h1 style="">哈哈哈&nbps;<span></span></h1>
console.log(m2);开源协议
ISC
