zxr_toole
v1.0.0
Published
提供格式化时间的功能
Downloads
5
Readme
安装
npm install zxr_toole
导入
const zxr = require('zxr_toole')
格式化时间用法
// 调用 dataF 对时间进行格式化
const dat = str.dataF(new Date())
// 结果 2020-09-02 19:02:40
console.log(dat);
转义 HTML 中的特殊字符
// 定义带转换的 HTML 字符串
const add = '<h1 title="abc">h1标签<span>123456&nbhp;</span></h1>'
// 调用 htmlE 方法进行转换
const s = str.htmlE(add)
// 转换结果 lt;h1 title="abc">h1标签<span>123456&nbhp;</span></h1>
console.log(s);
还原 HTML 中的特殊字符
// 定义带转换的 字符
const a = '<h1 title="abc">h1标签<span>123456&nbhp;</span></h1>'
// 调用 htmlUn 方法进行转换
const d = str.htmlUn(a)
// 转换结果 <h1 title="abc">h1标签<span>123456&nbhp;</span></h1>
console.log(d);
开源协议
ISC