1.0.0 • Published 9 months ago

one-pac v1.0.0

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

安装

npm install one-pac

导入

import one-pac from "one-pac"

格式化时间

//调用dateFormat 对时间进行格式化
const dateStr = one_pac.dateFormat(new Date())
console.log(dateStr);//2024-11-01 13:47:28

转义html中的特殊字符

//待转换的html字符串
const str = "<h1>这是h1</h1>,<span>这是span</span>"
//打印出转换后的html特殊字符
console.log(one_pac.HtmlEscape(str));//&lth1&qt这是h1&lt/h1&qt,&ltspan&qt这是span&lt/span&qt
//打印出还原后的html中的特殊字符
console.log(one_pac.UnHtmlEscape(str));//<h1>这是h1</h1>,<span>这是span</span>

开源协议

ISC

1.0.0

9 months ago