1.1.0 • Published 1 year ago
itheima-tools-zlf v1.1.0
安装
npm install itheima-tools-zlf
导入
js
const itheima = require('itheima-tools-zlf')
格式化时间
const newtime = require('./itheima-tools-zlf')
const times = newtime.formatDate(new Date())
console.log(times)
转义 Html 特殊字符
//待转换html字符串
const htmlstr = '<div title="box">hello world<span>你好啊 </span></div>';
//调用htmlEscape方法
const newHtml = htmls.htmlEscape(htmlstr);
console.log(newHtml, "字符");
// 结果 <div title="box">hello world<span>你好啊&nbsp</span></div>
反转义
const hhh = htmls.htmlUnEscape(nweHTMLL);
console.log(hhh, "反转义");
开源协议
ISC