Package Exports
- 17-itheima-tools-ceshiceshi
- 17-itheima-tools-ceshiceshi/index.js
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 (17-itheima-tools-ceshiceshi) 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 17-itheima-tools-ceshiceshi
导入
const itheima = require('17-itheima-tools-ceshiceshi')
格式化时间
const dt = itheima.dateFormat(new Date())
console.log('格式化后的时间:', dt);
转义 HTML 中的特殊字符
// 待转换的 HTML 字符串
const htmlStr = '<h1 style="color:red;">你好, ©<span>小黄!</span></h1>'
// 调用 htmlEscape 方法进行转换
const str = itheima.htmlEscape(htmlStr)
console.log('转义后的字符:', str);
还原 HTML 中的特殊字符
const htmlUn = itheima.htmlUnEscape(str)
console.log('还原特殊字符串后的HTML:', htmlUn);
开源协议
ISC