1.0.2 • Published 1 year ago
oyhrsb-tools v1.0.2
安装
npm install itheima-tools
导入
const itheima = require('itheima-tools')
格式化时间
//调用 dateFormat 对时间进行格式化
const dataStr= itheima.dataFormat(new Date())
//结果 2022-12-02 20:32:23
console.log(dataStr)
转义 HTML中的特殊字符
//调用htmlEscape 方法进行转换
const it = itheima.htmlEscape('<h1>这是转移</h1>')
//转换的结果<h1>这是转移</h1>
console.log(lt)
还原HTML中的特殊字符
//调用htmlhtmlUnEscape()
const it = itheima.htmlEscape('<h1>这是转移</h1>')
// console.log(it);
const ite = itheima.htmlUnEscape(it)
console.log(ite);
开源协议
ISC
1.0.2
1 year ago