itiheima-tools-zb

1.0.0 • Public • Published

安装方式

    node install itheima-tools-zb

导入方式

    const itheima = require('itheima-tools-zb');

格式化时间

    //代码演示
    const date = new Date();
    console.log(itheima.dateFormat(date));
    //输出结果  2022-11-08 14:12:43

转移HTML特殊字符

    //代码演示
    const htmlStr = '<h1 href="&">这是一个HTML转义字符的方法</h1>';
    console.log(itheima.HTMLEscape(htmlStr));
    //输出结果  &lt;h1 href=&quot;&amp;&quot;&gt;这是一个HTML转义字符的方法&lt;/h1&gt;

还原HTML转移字符

    //代码演示
    const htmlStr = '<h1 href="&">这是一个还原HTML转义字符的方法</h1>';
    const str = itheima.HTMLEscape(htmlStr);
    console.log(itheima.HTMLUnEscape(str));
    //输出结果  <h1 href="&">这是一个还原HTML转义字符的方法</h1>

开源协议

ISC

Package Sidebar

Install

npm i itiheima-tools-zb

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

2.67 kB

Total Files

5

Last publish

Collaborators

  • promisefuture