1.0.0 • Published 2 years ago
ithima-fishy v1.0.0
安装
npm install itheima-fishy
导入
const itheima = require('itheima-fishy')
格式化时间
// 调用dateFormat对时间进行格式化
const dtStr = ithema.dateFormat(new Date())
// 打印输出格式化后的时间字符串
console.log(dtStr)
转义html中的特殊字符
// 待转换的html字符串
const htmlStr = '<div style="color:red">商品名称: 葡萄</div>'
// 调用htmlEscape进行转换
const str = itheima.htmlEscape(htmlStr)
// 转换的结果 <div style="color:red">商品名称:&nbsp;葡萄</div>
console.log(str);
开源协议
ISC
1.0.0
2 years ago