1.0.0 • Published 7 months ago

emily-tools v1.0.0

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

安装

npm instlal emily-tools

导入

const emily = require('emily-tools')

格式化时间

//调用 dateFormat 对时间进行格式化
cosnt dtStr = emily.dateFormat(new Date())
//结果 2023-10-24 15:26:00
console.log(dtStr)

转义 html中的特殊字符

//带转换的 html 字符串
const htmlStr = '<h1 title="aoe">我是h1标签<span>123&nbsp;</span></h1>'
//调用 htmlEscape 进行转换
cosnt str = emily.htmlEscape(htmlStr)

还原 html中的特殊字符

//待还原的 html 字符串
const str = emily.htmlUnEscape(htmlStr)

开源协议

ISC

1.0.0

7 months ago