1.0.0 • Published 5 years ago

jinzi888_tools v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

安装

npm install jinzi888_tools

导入

const j = require('./index')

格式化时间

//调用dataFormat对时间进行格式化
const date1 = j.dataFormat(new Date())
console.log(date1);

转义HTML中的特殊字符

//待转换的HTML字符串
let htmlStr = '<h1>hello"hei"&nbsp;</h1>'
htmlStr = j.htmlEscape(htmlStr);
console.log(htmlStr);

还原HTML中的特殊字符

htmlStr = j.htmlUnEscape(htmlStr);
console.log(htmlStr);

开源协议

ISC

1.0.0

5 years ago