0.0.2 • Published 1 month ago
lc-tools v0.0.2
安装
npm install lc-tools
导入
const lc = require('lc-tools')
格式化时间
//调用时间转换方法
const dtStr = lc.dateFormat(new Date())
console.log(dtStr);
转义
//转换html字符串
const htmlStr = '<h1 title="测试">这是测试标签!<span>09- 16</span></h1>'
//调用方法
const htmlCs = lc.htmlEscape(htmlStr)
//结果 : <h1 title="测试">这是测试标签!<span>09-&nbsp;16</span></h1>
console.log(htmlCs)
//调用转换还原方法
//调用方法
const htmlUnCs = lc.htmlUnEscape(htmlCs)
//结果:<h1 title="测试">这是测试标签!<span>09- 16</span></h1>
console.log(htmlUnCs)