1.0.0 • Published 1 year ago
hjh_tools_utils v1.0.0
安装
npm install hjh_tools_utils
导入
const tools = require('hjh_tools_utils')
格式化时间
//对指定日期进行格式化并输出
const date=new Date()
console.log(tools.format(date))
转义 HTML 中的特殊字符
// 转义 HTML 特殊字符串
// 例如:<h1 title="caption">何家辉</h1> 转义成 <h1 title="caption">何家辉<h1>
const htmlStr='<h1 title="caption">何家辉</h1>'
const zhuanhuan=tools.zhuanhuan(htmlStr)
console.log(zhuanhuan)
还原 HTML 中的特殊字符
// 还原 HTML 特殊字符串
// 例如: <h1 title="caption">何家辉<h1>还原成 <h1 title="caption">何家辉</h1>
const htmlStr2='<h1 title="caption">何家辉</h1>'
const huanyuan=tools.huanyuan(htmlStr2)
console.log(huanyuan)
开源协议
ISC
1.0.0
1 year ago