1.0.0 • Published 2 years ago
jared-tools v1.0.0
jared的工具箱
安装
npm install jared-tools
导入
const jaredTool=require('jared-tools');
##格式化时间
const newData=dateFormat(new Date());
console.log(newData);
// 2022-11-07 14:48:03
转译html特殊字符
const htmlStr=`<h1 title="abc">this is h1<span>123 </span></h1>`;
const newStr=htmlEscape(htmlStr);
console.log(newStr);
//<h1 title="abc">this is h1<span>123&nbsp;</span></h1>
反转译html特殊字符
const unHtmlStr=`<h1 title="abc">this is h1<span>123&nbsp;</span></h1>`;
const unStr=htmlUnEscape(unHtmlStr);
console.log(unStr);
//<h1 title="abc">this is h1<span>123 </span></h1>;
1.0.0
2 years ago