ithzw-tools
v1.0.0
Published
提供了格式化时间,HTML Escape的功能
Readme
##安装方法
npm install ithzw-tools##导入方式
const ithzw = require('ithzw-tools')
##格式化时间
//调用dataeFeFormat方法对时间进行格式化
const dtStr = ithzw.dateFeFormat(new Date())
console.log(dtStr)
//结果 2024-11-13 18:31:14##转义html中的特殊字符
//待转换的html字符串
const htmlStr = '<h1 title="abc">这是h1标签<span>123 </span></h1>'
const str = ithzw.escapeHTML(htmlStr)
console.log(str)
//转义的结果 <h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>##还原html中的转义字符
const str2 = ithzw.unescapeHTML(Str)
console.log(str2)##开源协议 ISC
