Socket
Socket
Sign inDemoInstall

01-code

Package Overview
Dependencies
93
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    01-code


Version published
Maintainers
1
Created

Readme

Source
i5ting_ztree_toc: pre { counter-reset: line-numbering; border: solid 1px #d9d9d9; border-radius: 0; background: #fff; padding: 0; line-height: 23px; margin-bottom: 30px; white-space: pre; overflow-x: auto; word-break: inherit; word-wrap: inherit; } pre a::before { content: counter(line-numbering); counter-increment: line-numbering; padding-right: 1em; /* space after numbers */ width: 25px; text-align: right; opacity: 0.7; display: inline-block; color: #aaa; background: #eee; margin-right: 16px; padding: 2px 10px; font-size: 13px; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } pre a:first-of-type::before { padding-top: 10px; } pre a:last-of-type::before { padding-bottom: 10px; } pre a:only-of-type::before { padding: 10px; } .highlight { background-color: #ffffcc } /* RIGHT */ </style>
    					</ul>
    			</div>
        <div id='readme' style='width:70%;margin-left:20%;'>
          	<article class='markdown-body'>
            	<h2 id="-">包的说明文档</h2>
    

    安装

    
    npm install itheima-tools
    

    导入

    const itheima = require('itheima-tools')
    

    格式化时间

    //调用 dateFormat 对时间进行格式化
    const dtStr = itheima.dateFormat(new Date())
    console.log(dtStr)
    //结果 2022-08-31 17:23:47
    

    转义 HTML 中的特殊字符

    // 待转换的 HTML 字符串
    const htmlStr = '<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>'
    // 调用 htmlEscape 方法进行转换
    const str = itheima.htmlEscape(htmlStr)
    // 转换的结果 &lt;h1 title=&quot;abc&quot;&gt;这是h1标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
    console.log(str)
    

    还原 HTML 中的特殊字符

    // 待还原的 HTML 字符串
    const str2 = itheima.htmlUnEscape(str)
    // 输出的结果 <h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>
    console.log(str2)
    

    开源协议

    ISC

          	</article>
        </div>
    	</div>
    

FAQs

Last updated on 05 Sep 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc