1.0.0 • Published 5 months ago

itheima-gjs-tools v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

安装

npm install itHeiMa-gjs-tools

导入

const itheima = require("itHeiMa-gjs-tools");

格式化时间

//调用 对时间进行格式化
const dataFormat = itheima.dateFormat(new Date());
//结果 2025-02-06 14:36:50
console.log(dataFormat);

转义特殊字符

// 需要转义的字符串
const htmlStr = '<h1 title="&123">123456asd789qwe</h1>';
// 转义之后接取
const zy = itheima.htmlEscape(htmlStr);
// 输出转义字符串 结果&lt;h1 title=&quot;&amp;123&quot;&gt;123456asd789qwe&lt;/h1&gt;
console.log(zy);

转义回原本字符

// 接取
const fh = itheima.htmlUnEscape(zy);
// 输出 结果<h1 title="&123">123456asd789qwe</h1>
console.log(fh);

开源协议

ISC

1.0.0

5 months ago