1.0.1 • Published 2 years ago
itheima-hand_of_god v1.0.1
安装
npm install itheima-hand_of_god
导入
cosnt itheima = require('itheima-hand_of_god')
格式化时间
// 调用 dataFormat 对时间进行格式化
const dtStr = itheima.dateFormat(new Date())
// 结果 例:2000-01-01 08:30:55
console.log(dtStr)
转义HTML特殊字符
// 调用 htmlEscape 方法进行转换
const str = itheima.htmlEscape('<h1 style="color:#red">鸡你太美!</h1>');
// 转换的结果 <h1 style="color:#red">鸡你太美!</h1>
console.log(str);
还原HTML特殊字符
// 调用 htmlUnEscape 方法进行还原
const unstr = itheima.htmlUnEscape('<h1 style="color: #red">鸡你太美!</h1>');
// 结果 <h1 style="color: #red">鸡你太美!</h1>
console.log(unstr);
开源协议
ISC