1.0.0 • Published 4 years ago
itheima-demo-lx v1.0.0
安装
npm install itheima-demo-lx
导入
const itheima = require('itheima-demo-lx')
格式化时间
// 调用时间格式化方法
const dt =itheima.formDate(new Date());
// 结果 2020-10-14 15:58:39
console.log(dt);
转义html中的特殊字符
// 调用转义html中的特殊字符方法
const htmlStr = itheima.htmlIEscape('<h1 style="color:green;">Hello Mymodule!</h1>')
// 结果 <h1 style="color:green;">Hello Mymodule!</h1>
console.log(htmlStr);
还原html中的特殊字符
const htmlStr = itheima.htmlUnEscape('<h1 style="color:green;">Hello Mymodule!</h1>')
// 结果 <h1 style="color:green;">Hello Mymodule!</h1>
console.log(htmlStr);
开源协议
ISC
1.0.0
4 years ago