1.0.0 • Published 2 years ago

itxiaoz v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

安装方式

npm i itxiaoz

导入方式

const itxiaoz = require('itxiaoz')

格式化时间

// 传入一个时间,进行时间格式化
const date = itxiaoz.dateFormat(new Date())
console.log(date);
//输出结果 2023年-05月-19日 星期五 15:45:26

转义HTML中的特殊字符 < > " &

// 将字符串中的 < > 进行了转换
const str = '<h1>在这里准备干什么! </h1>'
let newstr = itxiaoz.htmlUnEscape(str)
console.log(newstr);
//输出结果 &lt;h1&gt;在这里准备干什么!&amp; &lt;/h1&gt;

还原HTML中的特殊字符 < > & "

// 将HTML中的特殊字符还原 &lt; &gt; &amp; &quot;
const str = '&lt;h1&gt;在这里准备干什么!&amp; &lt;/h1&gt;'
let newstr = itxiaoz.htmlUnEscape(str)
console.log(newstr);
//输出结果 <h1>在这里准备干什么!& </h1>

开源协议

ISC