1.0.0 • Published 1 year ago

jc_yys v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

安装

npm install jc_yys

导入

const jc = require("jc_yys");

格式化时间

// 调用dataFormat对时间进行格式化
const dtstr = jc.dateFormat(new Date().toLocaleString());
// 格式化结果:2023-01-10 17:56:19
console.log(dtstr);

转义 HTML 中特殊字符

// 调用htmlStr进行转义
const htmlstr = "<h1>&会转换</h1>";
const str = jc.htmlStr(htmlstr);
// 转换结果:$lth1$gt$quot会转换$lt/h1$gt
console.log(str);