7xia-utils
v1.0.0
Published
提供了日期格式化, html字符转译等功能
Downloads
22
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
