1.0.0 • Published 4 years ago
fy-util v1.0.0
安装
npm install fy-util
导入
const fyUtil = require('fy-util')
方法
- dateFormat 格式化时间
- htmlEscape 转义 html 特殊字符
- htmlUnescape 将转义后的字符串,反转成 html
dateFormat
const dt = new Date()
console.log(dateFormat(dt)) // 2021-12-12 02:24:03
htmlEscape
const htmlStr = '<div><span>"a" & "b"</span></div>'
console.log(htmlEscape(html)) // <div><span>"a" & "b"</span></div>
htmlUnEscape
const str =
'<div><span>"a" & "b"</span></div>'
console.log(htmlUnEscape(str)) // <div><span>"a" & "b"</span></div>
开源协议
ISC
1.0.0
4 years ago