wwk-lbwnb

卢本伟牛逼

Usage no npm install needed!

<script type="module">
  import wwkLbwnb from 'https://cdn.skypack.dev/wwk-lbwnb';
</script>

README

安装

npm install wwk-lbwnb

导入

const wwk = require('./wwk-lbwnb')

格式化时间

// 调用wwk-lbwnb 中的 dateFormat对时间进行格式化
const dtStr = wwk.dateFormat(new Date())
// 结果 2020-12-06 20:09:54
console.log(dtStr)

转义 HTML 里的特殊字符

// 待转换的字符
const htmlStr = '<h1 title="abc">这是h1标签<span>123$nbsp;</span></h1>'
// 调用wwk-lbwnb 中的 htmlEscape 方法进行转换
const str = wwk.htmlEscape(htmlStr)
// 输出结果
console.log(str);

还原 HTML 里的特殊字符

// 待还原的 HTML 字符
const htmlUnStr = wwk.htmlUnEscape(str)
// 输出结果
console.log(htmlUnStr);