1.0.0 • Published 2 years ago
itheima-tools-wxq v1.0.0
安装
npm install itheima-tools-wxq
导入
const itheima = require('itheima-tools')
格式化时间
let dtStr = itheima.dateFormat(new Date())
console.log(dtStr)
// result:
// 2022-4-11 23:34
转义html中的特殊字符
let htmlStr = '<h1 title="abc">这是h1标签<span>123 </span></h1>'
let str = itheima.htmlEscape(htmlStr)
console.log(str)
// result:
// <h1 title="abc">这是h1标签<span>123&nbsp</span></h1>
还原html中的特殊字符
let str = '<h1 title="abc">这是h1标签<span>123&nbsp</span></h1>'
let htmlStr = itheima.htmlUnEscape(str)
console.log(htmlStr)
//result:
// <h1 title="abc">这是h1标签<span>123 </span></h1>
开源协议
ISC
1.0.0
2 years ago