1.0.0 • Published 3 years ago

xinxin1 v1.0.0

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

安装

npm i xinxin1

导入

const xinxin = require('xinxin')

格式化时间的功能

//调用 dateFormat 方法
const dtStr =TIME.dateFormat(new Date())
//调用的结果 2020-11-28 15:40:39
console.log(dtStr);

转义 html字符 方法

const h1 = '< h1 > 123"567" &nbsp; 78</h1 > '
//调用 htmlEscape 方法
let str = HTML.htmlEscape(h1)
//调用结果 &lt; h1 &gt; 123&quot;567&quot; &amp;nbsp; 78&lt;/h1 &gt;
console.log(str);

还原 html字符 方法

const h1 = '&lt; h1 &gt; 123&quot;567&quot; &amp;nbsp; 78&lt;/h1 &gt; '
//调用 unhtmlEscape 方法
let str = HTML.unhtmlEscape(h1)
//调用结果 < h1 > 123"567" &nbsp; 78</h1 >
console.log(str);

协议

ISC