1.1.2 • Published 2 years ago

mingy-tools v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

这是my-tools的使用说明文档

安装

npm install mingy-tools

导入

const my = require('mingy-tools')

格式化时间

// 调用dataFormat格式化时间
const d = my.dataFormat(new Date())
console.log(d) //2022-07-10 15:34:31

html字符转义

// 调用htmlEscape 对html中的特殊字符进行转义
const htmlStr = my.htmlEscape('<h1 title="abc">这是<span>h1&nbsp;</span>标签</h1>')
console.log(htmlStr) 
// &lt;h1 title=&quot;abc&quot;&rt;这是&lt;span&rt;h1&amp;nbsp;&lt;/span&rt;标签&lt;/h1&rt;

html转义字符还原

// 调用htmlUnEscape对html中转义的字符进行还原
const str = my.htmlUnEscape(htmlStr)
console.log(str) 
// <h1 title="abc">这是<span>h1&nbsp;</span>标签</h1>

开源协议 licence

ISC