Package Exports
- hua-tools
- hua-tools/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hua-tools) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
安装
npm install hua-tools
导入
const hua = require('hua-tools')
时间格式化
//引用时间格式化函数
const newDt = hua.dataFormat(new Date())
console.log(newDt);
// 结果为 2023-05-26 11:10:26
转义HEML特殊字符
const str = '<h1>我是一个天才啊</h1>'
const escapeStr = hua.htmlEscape(str)
console.log(escapeStr);
// 结果为<h1>我是一个天才啊</h1>
还原HTML特殊字符
const str2 = hua.htmlUnEscape(escapeStr)
console.log(str2);
// 结果为<h1>我是一个天才啊</h1>
开源协议
ISC