1.0.0 • Published 2 years ago
yinf-tools v1.0.0
安装
npm install yinf-tools
导入
const yinf = require('yinf-tools')
格式化时间
// 调用 dateFormat 对时间进行格式化
const dtStr = yinf.dateFormat(new Date())
// 结果 2022-07-12 21:00:00
console.log('dtStr')
转译 HTML 中的特殊字符
// 调用 HTMLEscpae 进行转换
const str = yinf.HTMLEscpae('&<h1>"hh"')
// 结果 &<h1>"hh"
console.log(str);
还原 HTML 中的特殊字符
// 调用 HTMLUnEscpae 进行转换
const str2 = yinf.HTMLUnEscpae('&<h1>"hh"')
// 结果 &<h1>"hh"
console.log(str2);
开源协议
ISC
1.0.0
2 years ago