1.0.0 • Published 3 years ago
awuu v1.0.0
安装
npm install awuu
导入
// 指定到入口文件
const awuu = require("./awuu/index");
// 或者指定到包所处文件夹
const awuu2 = require("./awuu");
用法
格式化时间
// 调用包内格式化函数
const r = awuu.dateFormat("2021/10/8 15:25");
const r2 = awuu2.dateFormat(new Date());
console.log(r); // 输出结果:2021-10-08 15:25:00
console.log(r2); // 输出结果:2021-10-18 16:33:30
转义html字符串
// 调用包内 转义html字符串函数
const h1 = awuu.htmlEscape('<h1>转义html字符串"&"</h1>');
console.log(h1); // 输出结果:<h1>转义html字符串"&"</h1>
还原html字符串
// 调用包内 还原html字符串函数
const h2 = awuu.escape2html(h1);
console.log(h2); // 输出结果:<h1>转义html字符串"&"</h1>
开源协议
ISC
1.0.0
3 years ago