Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

zjx-utils

zjxdm3isc1.0.1

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

format, escape, zjx-utils

readme

Install 安装

npm i zjx-utils

Require 导入

const utils = require('zjx-utils')

Usage 使用方法

  • 格式化日期

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

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

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