1.0.1 • Published 2 years ago

le-utils v1.0.1

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

le-tools Doc

1.安装

npm install le-tools

2.导入

const le = require('le-tools');

3.格式化时间

//调用dateFormat对时间进行格式化
date.dateFormat(new Date());
//结果:2022-04-07 14:52:37

4.转义HTML中的特殊字符

console.log(date.HTMLEscape('<h1 id="h">h1标签<span style="color: red;">123&nbsp;</span></h1>'));
// &lth1 id=&quoth&quot&gth1标签&ltspan style=&quotcolor: red;&quot&gt123&ampnbsp;&lt/span&gt&lt/h1&gt

5.还原HTML中的特殊字符

console.log(date.HTMLUnEscape('&lth1 id=&quoth&quot&gth1标签&ltspan style=&quotcolor: red;&quot&gt123&ampnbsp;&lt/span&gt&lt/h1&gt'));
// <h1 id="h">h1标签<span style="color: red;">123&nbsp;</span></h1>

6.遵守的协议

ISC