1.0.0 • Published 1 year ago
itheima-tools-denglong v1.0.0
安装
npm install itheima-tools
导入
const itheima = require('itheima-tools-denglong')
格式化时间
//调用dateFormat 对时间进行格式化
const itheima = require('./itheima-tools')
const nowTime = new Date()
const dateStr = itheima.dateFormat(nowTime)
//结果2023-01-29 15:39:45
console.log(dateStr)
转义 HTML 中的特殊字符串
const newStr = itheima.htmlEscape('<h1 style="color:blue;">哈哈哈哈</h1>')
//转换结果 <h1 style="color:blue;">哈哈哈哈</h1>
console.log(newStr);
开源协议
ISC
1.0.0
1 year ago