itheima-shanhu
1.0.1 • Public • Published
npm install itheima-shanhu
const itheima = require('itheima-shanhu')
const dt = itheima.dateFormat(new Date())
// 输出 2020-01-20 10:47:32
console.log(dt)
// 待转换的 HTML 字符串
const htmlStr = '<h1 style="color: red;">你好!©<span>小黄!</span></h1>'
// 调用 htmlEscape 进行转换
const str = itheima.htmlEscape(htmlStr)
// 输出 <h1 style="color: red;">你好!&copy;<span>小黄!</span></h1>
console.log(str)
const rawHTML = itheima.htmlUnEscape(str)
// 输出 <h1 style="color: red;">你好!©<span>小黄!</span></h1>
console.log(rawHTML)
/itheima-shanhu/
//
Package Sidebar
Install
Weekly Downloads