zyx-tools
v1.0.1
Published
提供了格式化时间、HTMLEscape相关功能
Downloads
9
Maintainers
Readme
安装
npm install zyx-tools##导入
const zyxTools = require('zyx-tools');##格式化时间
//格式化时间功能
const dtstr = zyxTools.dateFormate(new Date());
//结果 2023-09-10 11:34:16##转移 HTML 中的特殊字符
//待转换的htm1字符串
const htmlstr ='<h1 title="abc">这是h1标签<span>123 </span></h1>';
const str= zyxTools.htmlEscape(htmlstr);
// 结果 <h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>##还原 HTML 中的特殊字符
//待还原的htm1字符串
const str ="<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>";
const htmlStr = zyxTools.htmlEscape(str);
//结果<h1 title="abc">这是h1标签<span>123 </span></h1>##开源协议 ISC
