1.0.0 • Published 1 year ago
itheima-tools-jzh123 v1.0.0
安装
npm install itheima-tools-jzh
导入
const itheima = require("./index.js");
格式化时间
// 调用dateFormat对时间进行格式化
let dataStr = date.dateFormat(new Date());
console.log(dataStr); //结果
转义 HTML 中的特殊字符
// 调用escapeHTML对字符串进行转义
let str = "<h1>hello</h1>";
let result = itheima.htmlEscape(str);
console.log(result); //结果
还原 HTML 中的特殊字符
let htmlStr = "<h1>hello</h1>";
let htmlResult = itheima.htmlUnEscape(htmlStr);
console.log(htmlResult); //结果
开源协议
ISC
1.0.0
1 year ago