xyf-node-utils
v1.0.0
Published
格式化日期 html特殊字符转换
Downloads
2
Readme
1.安装
npm install xyf-node-utils
2.导入
const utils = require("xyf-node-utils")
3.API
3.1日期格式化
const dd = utils.dateFormat(new Date())
//打印 yyyy-MM-dd HH:mm:ss
console.log(dd)
3.2html转换为转义字符
let str = '<h1 style="color:red;">你好!©<span>小黄</span></h1>'
let str2 = utils.htmlEscape(str)
//打印:<h1 style="color:red;">你好!&copy<span>小黄</span></h1>
console.log(str2)
3.3转义字符转换为html字符
let str = '<h1 style="color:red;">你好!&copy<span>小黄</span></h1>'
let str2 = utils.htmlUnEscape(str)
//打印:<h1 style="color:red;">你好!©<span>小黄</span></h1>
console.log(str2)
4.开源协议
ISC