1.0.0 • Published 1 year ago

my-tools-guigu v1.0.0

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

安装

npm install my-tools-guigu

导入

const tools = require('my-tools-guigu')

格式化时间

// 格式化日期
const dt = new Date()
console.log(tools.dateFormat(dt))

转义 HTML 中的特殊字符

// 转义 HTML 特殊字符串
const htmlStr_escape = '<h1 title="mytitle">这是H1标题</h1>'
const result_escape = tools.htmlEscape(htmlStr_escape)
console.log(result_escape)

还原 HTML 中的特殊字符

// 还原 HTML 特殊字符串
const htmlStr_unescape = '&lt;h1 title=&quot;mytitle&quot;&gt;这是H1标题&lt;/h1&gt;'
const result_unescape = tools.htmlUnEscape(htmlStr_unescape)
console.log(result_unescape)

开源协议

ISC