Socket
Socket
Sign inDemoInstall

zjitc-tools3

提供了格式化时间、HTMLEscape相关功能


Version published
Maintainers
1

Readme

Source

##安装

npm install zjitc-tools

##导入

const zjitc=require('zjitc-tools')

##格式化时间

//调用dataFormat  对时间进行格式化
const dataStr=zjitc.dataFormat(new Date())
//结果:2021-10-25 14:35:31
console.log(dataStr)

##转义HTML中的特殊字符


//待转换的HTML字符串
const htmlStr = '<h1 title="abc">我是学生&nbsp;<span>123</span></h1>'

//调用htmlEscape() 进行转换
const str=zjitc.htmlEscape(htmlStr)

//转换结果:&lt;h1 title=&quot;abc&quot;&gt;我是学生&amp;nbsp;&lt;span&gt;123&lt;/span&gt;&lt;/h1&gt;
console.log(str)

##还原HTML中的特殊字符串

//待还原的HTML字符串

const str2=zjitc.htmlunEscape(str)
//输出结果:<h1 title="abc">我是学生&nbsp;<span>123</span></h1>
console.log(str2)

##开源协议

ISC

Keywords

FAQs

Last updated on 25 Oct 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc