1.0.0 • Published 2 years ago

itleizi-tools v1.0.0

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

安装

npm install itleizi-tools

引用

const itcolin = require('itleizi-tools')

使用1:时间格式化

const tmie = itcolin.getDtime(new Date())
console.log('tmie:', tmie)
// 2023-02-28 15:15:15

使用2:转义html

const str = '<h1 style="height: 20px;">66666</h1>'
const htmlStr = itcolin.htmlEscape(str)
console.log('htmlStr:', htmlStr)
// 打印结果:&lt;h1 style=&quot;height: 20px;&quot;&gt;66666&lt;/h1&gt;

使用3:反义html

const htmlStr = '&lt;h1 style=&quot;height: 20px;&quot;&gt;66666&lt;/h1&gt;'
const html = itcolin.unHtmlEscape(htmlStr)
console.log('html:', html)
// 打印结果: <h1 style="height: 20px;">66666</h1>
1.0.0

2 years ago