itheima-tools-wtf
1.0.0 • Public • Published
npm install itheima-tools-wtf
const itheima = require('itheima-tools-wtf')
// 调用 dataFormat 对时间进行格式化
const dtStr = itheima.dataFormat(new Date())
console.log(dtStr) //2024-02-04 14:38:03
// 定义待转换的 HTML 的字符串
const htmlStr = '<h1 title="abc">这是h1标签<span>123 </span></h1>'
// 调用 htmlEscape 方法对字符串进行转换
const newStr = itheima.htmlEscape(htmlStr)
console.log(newStr) //<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>
// 调用 htmlEscape 方法对字符串进行还原
const oldStr = itheima.htmlUnEscape(newStr)
console.log(oldStr) //<h1 title="abc">这是h1标签<span>123 </span></h1>
Versions
Current Tags
Version | Downloads (Last 7 Days) | Tag |
---|
1.0.0 | 0 | latest |
Version History
Version | Downloads (Last 7 Days) | Published |
---|
1.0.0 | 0 | |
Package Sidebar
Install
Weekly Downloads