npm install itheima-tool
const itheima=require('./itheima-tool')
const dt=new Date()
const newDT=itheima.dataFormat(dt)
console.log(dt)
console.log(newDT)
<!-- 结果 -->
2024-11-13T05:43:38.485Z
2024-11-13 13:43:38
const htmlStr='<h1 title="abc">这是h1标签<span>123 </span></h1>'
const str=itheima.htmlEscape(htmlStr)
console.log(str)
<!-- 结果 -->
<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>
const htmlStr='<h1 title="abc">这是h1标签<span>123 </span></h1>'
const str1=itheima.htmlUnEscape(htmlStr)
console.log(str1)
<!-- 结果 -->
<h1 title="abc">这是h1标签<span>123 </span></h1>
ISC