720zforever-utils

这是一个格式化时间和转义html标签的包

Usage no npm install needed!

<script type="module">
  import 20zforeverUtils from 'https://cdn.skypack.dev/720zforever-utils';
</script>

README

Install 安装

nmp i 720z-utils

Require 导入

const utils = require('720z-utils')

Usage 使用方法

  • 格式化日期

    //调用格式化日期函数
    const dt = utils.formatDate('2021-1-1')
    console.log(dt);
    
  • 转义 html 标签的方法

    //调用转义 html 标签的方法
    const res = utils.escapeHTML('<span style="color: red">hello&nbsp;</span>')
    console.log(res);
    
  • 还原 html 标签的方法

    //调用还原 html 标签的方法
    const res2 = utils.unEscapeHTML('&ltspan style=&quotcolor: red&quot&gthello&ampnbsp;&lt/span&gt')
    console.log(res2);