jihua_my_tools
v1.0.0
Published
``` npm install my_tools ``` ## 导入 ```js const my_tools = require('my_tools') ``` ## 格式化时间 ```js const dStr = my_tools.dateFormat(new Date()) console.log("dstr------"+dStr) ``` ## 转义html代码 ```js // 使用字符串转义 const html
Downloads
5
Readme
npm init -y即可一键生成package.json的信息
这个包用来格式化时间的模块 dateFormat.js
这个包用来接收要进行格式化的html代码进行转义 htmlEscape.js
进行模块化拆分
安装
npm install my_tools
导入
const my_tools = require('my_tools')
格式化时间
const dStr = my_tools.dateFormat(new Date())
console.log("dstr------"+dStr)
转义html代码
// 使用字符串转义
const html = '<h1 title="abc">你好世界!</h1>'
const htmlStr = my_tools.htmlEscpace(html)
console.log("htmlStr------" + htmlStr)
还原html字符串
//还原html字符串
const UnhtmlStr = my_tools.htmlUnEscpace(htmlStr)
console.log("UnhtmlStr------" + UnhtmlStr)
开源协议
ISC