1.0.0 • Published 5 years ago
itheima-case v1.0.0
安装
npm install npmCase
导入
const npmCase = require('npmCase')
格式化时间
//调用dateFormat 对时间进行格式化
const dt = npmCase.dateFormat(new Date())
//2020-09-10 09:46:25
console.log(dt)
转义 HTML 中的特殊字符
//测试html转义
const str = '<h1>这是个标签<span>123 </span></h1>'
const newStr = npmCase.htmlEscape(str)
//转换结果: <h1>这是个标签<span>123&nbsp;</span></h1>
console.log(newStr)
还原 HTML 中的特殊字符
//测试还原html转义
const nt = npmCase.htmlUnEscape(newStr)
//转换结果: <h1>这是个标签<span>123 </span></h1>
console.log(nt)
开源协议
ISC
1.0.0
5 years ago