1.0.0 • Published 1 year ago
xxxx-tools v1.0.0
安装
npm i xxxx-tools
引入
const xxxx=require("./xxxx-tools/index")
格式化时间方法使用
const date=xxxx.dateFormat(new Date())
console.log(date);
//结果 2023-02-23 10:33:35
转义和还原html字符
const htmlStr='<h1 style="color:red">我是h1标签 <span>111 </span></h1>'
const str=xxxx.htmlEscape(htmlStr)
console.log(str)
//结果 <h1 style="color:red"&rt;我是h1标签 <span&rt;111&nbsp</span&rt;</h1&rt;
console.log(xxxx.htmlUnEscape(str))
//结果 <h1 style="color:red">我是h1标签 <span>111 </span></h1>
开源协议
ISC
1.0.0
1 year ago