1.1.0 • Published 3 years ago
xiaozhao-tools v1.1.0
安装
、、、 npm install xiaozhao-tools 、、、
导入
、、、js const xiaozhao=require('xiaozhao-tools'); 、、、
格式化时间
、、、js // 调用dateformat()对时间进行格式化 const dt = x.dateFormat(new Date()); // 输出结果 2022-07-10 15:21:04 console.log(dt); 、、、
转义HTML中的特殊字符
、、、js //待转换的HTML字符串 const HtmlStr='123' //调用HtmlEscape()进行转换 const str = x.HtmlEscape(HtmlStr) //转换结果<h1>123</h1> console.log(str); 、、、
还原HTML中的特殊字符
、、、js //待还原的字符串 const newStr = x.HtmlUnEscape(str); //输出的结果123 console.log(newStr); 、、、
开源协议
ISC
1.1.0
3 years ago