1.0.0 • Published 2 years ago

parker-tools v1.0.0

Weekly downloads
-
License
ICS
Repository
-
Last release
2 years ago

安装

npm install parker-tools

导入

const parker = require('parker-tools)

格式化时间

// 调用 dateFormat 对时间进行格式化
const dt = parker.dateFormat(new Date())
// 结果 2022-05-14 12:23:06

转义 HTML 中的特殊字符

// 掉转换的 HTML 字符串
const htmlStr = '<h1 title="abc">你好</h1>'
// 调用 htmlEscape 方法进行转换
const str = parker.htmlEscape(htmlStr)

还原 html 中的特殊字符

const str2 = parker.htmlUnEscape(str)

开源协议

ISC