1.0.0 • Published 10 months ago

formatdateandhtmlescape v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

介绍

此包可以实现任意时间日期的格式化及字符串特殊字符的编码和反转码

安装

  • tips: 仅仅提供nodeJs环境的安装

npm方式安装

npm i formatdateandhtmlescape

yarn方式安装

yarn add formatdateandhtmlescape

使用步骤

  • 导入模块包

    const formatdateandhtmlescape=require('formatDateAndHtmlEscape')
  • 使用包

    • 格式化时间日期

      // 获取当前时间
      const now=formatdateandhtmlescape.dateFormat()
    • 字符串中特殊字符转码

      let str = 'https://www.kuaijiankj.com?username=张三&age=28'
      str = formatdateandhtmlescape.htmlEscape(str) // https%3A%2F%2Fwww.kuaijiankj.com%3Fusername%3D%E5%BC%A0%E4%B8%89%26age%3D28
    • 字符串反转码

      let str="https%3A%2F%2Fwww.kuaijiankj.com%3Fusername%3D%E5%BC%A0%E4%B8%89%26age%3D28"
      str=formatdateandhtmlescape.htmlUnescape(str) // https://www.kuaijiankj.com?username=张三&age=28

开源协议

本包仅仅用于学习或者开发使用,不做任何商业用途,如有违反,将追究法律责任

1.0.0

10 months ago