1.0.0 • Published 1 year ago

damian_tools v1.0.0

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

安装

npm install damian_tools

导入

const damian_tools = require("damian-tools")

时间格式化

const newDT = damian_tools.dateFormat()
console.log(newDT)

转义HTML中的特殊字符

const htmlStr = '<h1 title = "abc">这是h1标签<span>123&nbsp;</span></h1>'
const str = damian_tools.htmlEscape(htmlStr)
console.log(str)

还原HTML中的特殊字符

// 输出的结果是 &lt;h1 title = "abc">这是h1标签&lt;span>123&amp;nbsp;&lt;/span>&lt;/h1>
const str2 = damian_tools.htmlUnEscape(str)
console.log(str2)

开源协议

ISC