UNPKG

itheima-tools-gdq

Version:

格式化时间,HTMLEscape的功能

36 lines (26 loc) 540 B
## 安装 ``` npm install itheima-tools-gdq ``` ## 导入 ```js const itheima = require('itheima-tools-gdq') ``` ## 格式化时间 ```js const td = itheima.dateFormat(new Date()) console.log(td); ``` ## 转换html 中的特殊字符 ```js const htmStr = '<h1>这是h1标签<span>11&nbsp;<span></h1>' const str = itheima.htmlEscape(htmStr) console.log('str',str); ``` ## 还原html 中的特殊字符 ```js const str2 = itheima.htmlUnEscape(str) console.log('str2',str2); ``` ## 开源协议 ISC