ycf-utils
v1.0.0
Published
```js npm install ycf-utils ```
Downloads
2
Readme
安装
npm install ycf-utils
导入
const ycfUtils = require('ycf-utils');
格式化时间
const dtStr = ycfUtils.dateFormat(new Date);
//2024-02-19 15:08:28
console.log(dtStr);
转义HTML中的特殊字符
const htmlStr = '<h1 title="abc">这个是h1标签<span>123 </sapn></h1>';
const str1 = ycfUtils.htmlEscape(htmlStr);
//<h1 title="abc">这个是h1标签<span>123&nbsp;</sapn></h1>
console.log(str1);
还原HTML中的特殊字符
const htmlStr = '<h1 title="abc">这个是h1标签<span>123&nbsp;</sapn></h1>';
const str1 = ycfUtils.htmlEscape(htmlStr);
//<h1 title="abc">这个是h1标签<span>123 </sapn></h1>
console.log(str1);
开源协议
ISC