hjfirst_tools

1.0.2 • Public • Published

安装

npm i hjfirst_tools

导入

const hj = require('hjfirst_tools')

格式化时间

//调用dateFormat对时间进行格式化
const dtStr = hj.dateFormate(new Date());
//输出结果 2022-11-10 19:03:13
console.log(dtStr);

转义html

const strs = '<h1 title="哥哥">你好,这是我的<span>妹妹&nbsp;"豆豆"</span></h1>';
//调用
const htmlstr = hj.htmlEscape(strs)
//结果&lt;h1 title=&quot;哥哥&quot;&gt;你好,这是我的&lt;span&gt;妹妹&amp;nbsp;&quot;豆豆&quot;&lt;/span&gt;&lt;/h1&gt;
console.log(htmlstr);

还原html特殊字符串

//调用
const htmls = hj.htmlUnEscape(htmlstr)
//结果<h1 title="哥哥">你好,这是我的<span>妹妹&nbsp;"豆豆"</span></h1>;

console.log(htmls);

开源协议

ISC

Readme

Keywords

Package Sidebar

Install

npm i hjfirst_tools

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

2.58 kB

Total Files

5

Last publish

Collaborators

  • jingxiaomao