1.0.0 • Published 2 years ago

wyt-tools v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago
npm install wyt
const wyt = require('wyt')
// 调用dateFormat对事件进行格式化
const dtStr = wyt.dateFormat(new Date())
// 结果 2022-03-29 09:44:58
console.log(dtStr)
// 定义转换的HTML字符串
const htmlStr = '<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>'
// 调用htmlEscape方法进行转换
const str = wyt.htmlEscape(htmlStr)
// 结果  &lth1 title=&quotabc&quot&gt这是h1标签&ltspan&gt123&ampnbsp;&lt/span&gt&lt/h1&gt
console.log(str)
// 待还原的HTML字符串
const htmlStr2 = wyt.htmlUnEscape(str)
// 结果 <h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>
console.log(htmlStr2)

ISC