1.0.0 • Published 1 year ago

leeshuo-tools v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

va安装方式

npm insatll leeshuo-tools

导入

const leeshuo = require('leeshuo-tools')

使用

  • 格式化时间

    const dateStr = leeshuo.daformat(new Date())
    console.log(dateStr)
  • 转义HTML中的特殊字符

    const htmlStr = '`<h1 style="color:red;">`你好!©`<span>`小黄!`</h1>`'
    const str = leeshuo.htmlEscape(htmlStr)
    console.log(str);// <h1 style="color:red;">你好!©<span>小黄!</span></h1>
  • 还原html中的特殊字符

    const rawHtml = leeshuo.htmlUnEscape(str)
    console.log(rawHtml);// <h1 style="color:red;">你好!©<span>小黄!</span></h1>
  • 对象判空

    let obj = {name:'leeshuo',age:23}
    let flag = leeshuo.isEmpty(obj)
    console.log(falg) //false

开源协议

ISC