chaos-mytools

1.0.1 • Public • Published

安装

npm install chaos-tools npm i chaos-tools

导入

const tools = require("./chaos-tools")

使用

使用tools封装的时间格式化方法

//导入
const tools = require("./chaos-tools")
tools.dateFormat()
//打印:2023-06-27 13:20:45

调用tools封装的将html标签转义为字符串方法

//导入
const tools = require("./chaos-tools")
const str = '<image src="https://www.baidu.com/icon.png" />'
//调用tools封装的将html标签转义为字符串方法
console.log(tools.htmlToStr(str) )
//打印:<image src="https://www.baidu.com/icon.png" />

调用还原通过htmlToStr方法替换后的字符串返回原来html字符串

const str1 = '\\<image src=\\"https://www.baidu.com/icon.png" \\/\\>'
console.log(tools.strToHtml(str1))
//打印:<image src="https://www.baidu.com/icon.png" />

开源协议

ISC

Package Sidebar

Install

npm i chaos-mytools

Weekly Downloads

3

Version

1.0.1

License

ISC

Unpacked Size

3.72 kB

Total Files

5

Last publish

Collaborators

  • chaos888