panl-tool

1.0.0 • Public • Published

##安装

nmp i panl-tool

##导入

const tem = require ('panl-tool')

##格式化时间

const date = tem.dateFormat(new Date())
// 结果: 2023/10/27 13:54:11

##转义HTML中的特殊字符

const htmlStr  = '<h1 title ="abc">这是h1标签<span>123&nbsp;</span></h1>'
const str = tem.htmlEscape(htmlStr)

// 结果: &lt;h1 title =&quot;abc&quot;&gt;这是h1标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;

##还原HTML中的特殊字符

const str2 = tem.htmlUnEscape(str)

// 结果: <h1 title ="abc">这是h1标签<span>123&nbsp;</span></h1>

##开源协议 ISC

/panl-tool/

    Package Sidebar

    Install

    npm i panl-tool

    Weekly Downloads

    0

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    2.68 kB

    Total Files

    6

    Last publish

    Collaborators

    • pchvj