Package Exports
- itheima-tools-dsj
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (itheima-tools-dsj) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
##安装方式
npm install itheima-tools-dsj
##导入方式
const dsj = require("itheimaitheima-tools-dsj");
##格式化时间
//将时间格式化的方法
const dtStr = dsj.dateFormat(new Date());
//2021-09-29 08:44:48
console.log(dtStr);
##转义 HTML 中的特殊字符
//HTML字符串
const htmlstr = '<h1 class="a">我是首页<span>123 </span></h1>';
//调用htmlEscape方法转换
const str = dsj.htmlEscape(htmlstr);
//转换的结果:<h1 class="a">我是首页<span>123&nbsp;</span></h1>
console.log(str);
##还原 HTML 中的特殊字符
//调用htmlUnEscape方法还原特殊字符串
const str2 = dsj.htmlUnEscape(str);
//输出的结果:<h1 class="a">我是首页<span>123 </span></h1>
console.log(str2);
##开源协议 ISC