1.0.1 • Published 1 year ago
zjp-tools v1.0.1
安装
npm install zjp-tools
导入
const zjp = require('zjp-tools')
格式化时间
// 调用函数格式化时间
const date = zjp.formatDate(new Date())
// 2023-02-05-21 21:55:23
console.log(date)
转义 html 文件特殊字符
// html 字符串
const htmlStr = '<h2 title="abc">这是h2标签<span>123 </span></h2>'
let res = zjp.htmlEscape(htmlStr)
// <h2 title="abc">这是h2标签<span>123&nbsp;</span></h2>
console.log(res);
还原 html 文件特殊字符
let rowHTML = htmlUnEscape(res)
// <h2 title="abc">这是h2标签<span>123 </span></h2>
console.log(rowHTML);
开源协议
ISC
1.0.1
1 year ago