1.0.0 • Published 2 years ago
itheima-tools-pete v1.0.0
安装
npm install itheima-tools
导入
const itheima = require("itheima-tools");
格式化时间
const dtStr = itheima.dateFormat(new Date());
console.log(dtStr);
//结果 2021:12:01 16:00:27
转义 HTML 字符串
const htmlStr = '这是>和<还有"和&';
const str = itheima.htmlEscape(htmlStr);
console.log(str);
//结果 这是>和<还有"和&
还原 HTML 字符串
const str2 = itheima.UnEscapeHtml(str);
console.log(str2);
//结果 这是>和<还有"和&
开源协议
ISC
1.0.0
2 years ago