Package Exports
- joel-tools
- joel-tools/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 (joel-tools) 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 joeltools
导入
const joeltools = require("./joel-tools");
格式化时间
// 调用 dateFormat 对时间进行格式化
const dtStr = joeltools.dateFormat(new Date());
// 结果 2025-09-16 17:31:36
console.log(dtStr);
转义 HTML 中的特殊字符
// 带转换的 HTML 字符串
const htmlStr = `<h1 class="title">Hello & welcome to my site</h1>`;
// 调用 htmlEscape 方法进行转换
const str = joeltools.htmlEscape(htmlStr);
// 结果 <h1 class="title">Hello & welcome to my site</h1>
console.log(str);
还原 HTML 字符串
// 调用 htmlUnEscape 方法进行转换
const str2 = joeltools.htmlUnEscape(str);
// 结果 <h1 class="title">Hello & welcome to my site</h1>
console.log(str2);
开源协议
ISC