ccunix-test01
v1.0.0
Published
``` npm install ccunixheima ``` ## 导入 ```js let ccunix = require('ccunix-heima') ```
Downloads
9
Readme
安装
npm install ccunixheima
导入
let ccunix = require('ccunix-heima')
格式化时间
//调用dateFormat 对事件格式化
//结果:2022-7-14 18:40:48
console.log(ccunix.dateFormat(new Date()));
转换html中的特殊字符
let html = '<div class="class1">我们都 好好学习</div>';
// 调用htmlEscape方法进行html字符串转换
let htmlEscape = ccunix.htmlEscape(html);
// 输出结果 <div class="class">我们都&nbsp;好好学习</div>
console.log(htmlEscape);
还原HTML中的特殊字符
//待还原的html字符串
let htmlUnEscape = ccunix.htmlUnEscape(htmlEscape);
//输出结果 <div class="class1">我们都 好好学习</div>
console.log(htmlUnEscape);
开源协议
IIS