1.0.0 • Published 3 years ago

dch-utils01 v1.0.0

Weekly downloads
48
License
MIT
Repository
-
Last release
3 years ago

1.安装

npm i dch-utils

2.引入

const utils = require('dch-utils');

3. 使用

  • 3.1 调用格式化时间的函数
const dt = utils.dateFormat(new Date);
//2021-2-21 15:52:26
console.log(dt);
  • 3.2 调用转义html标签的方法
const res = utils.escapeHTML('<span style="color:red">hello&nbsp</span>');
//&lt;span style=&quot;color:red&quot;&gt;hello&amp;nbsp&lt;/span&gt;
console.log(res);
  • 3.3 调用还原html标签的方法
const res2 = utils.unEscapeHTML('&lt;span style=&quot;color:red&quot;&gt;hello&amp;nbsp&lt;/span&gt;');
//<span style="color:red">hello&nbsp</span>
console.log(res2);

4.协议

MIT