Package Exports
- 7xia-utils
- 7xia-utils/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 (7xia-utils) 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 7xia-utils or npm i 7xia-utils导入
const 7xiaUtils = require('7xia-utils')日期格式化
// 调用 dateFormat 传入一个日期 对时间格式进行处理
const date = 7xiaUtils.dateFormat(new Date())
console.log('北京时间:' + date)
// 2023-03-28 11:11:59escape HTML字符转译
// 调用 htmlEscape 对HTML字符进行转译
const str = '<h1 title="a" >这是<span>h1</span>标签</h1>'
const scape = 7xiaUtils.htmlEscape(str)
console.log(8, scape)
// <h1 title="a" >这是h1标签</h1>还原HTML特殊字符转译
// 调用 htmlUnEscape 还原已转译的HTML特殊字符
const unScape = time.htmlUnEscape(scape)
console.log(11, unScape)
// <h1 title="a" >这是<span>h1</span>标签</h1>开源协议
ISC