dong973-tool

1.0.0 • Public • Published

安装

npm i dong973-tool

导入

const my = require("dong973-tool");

格式化时间

const dt = new Date();
console.log(my.dateFormat(dt));
// 结果:2022-10-30 21:14:31

转义 html 的特殊字符

原 html:

这是 h1 标签这是 span 标签

const ans = my.htmlEscope(htmlStr);
console.log(ans);
//<h1 style="abc">这是h1标签<span>这是span标签</span></h1>

还原 html 的特殊字符

const ans1 = my.escopeHtml(ans);
console.log(ans1);
//<h1 style="abc">这是h1标签<span>这是span标签</span></h1>

开源协议

ISC

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.056latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.056

Package Sidebar

Install

npm i dong973-tool

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

2.63 kB

Total Files

5

Last publish

Collaborators

  • dong973