wyt-tools

1.0.0 • Public • Published
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

Readme

Keywords

Package Sidebar

Install

npm i wyt-tools

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

2.56 kB

Total Files

5

Last publish

Collaborators

  • wytya