JSPM

itheima-taols-ddjs1

1.0.01
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1
    • Score
      100M100P100Q54250F
    • License ISC

    ll提供了时间格式化,HTMLescape的功能

    Package Exports

    • itheima-taols-ddjs1
    • itheima-taols-ddjs1/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (itheima-taols-ddjs1) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    安装

    npm i ithei-tools-ddjs

    导入

    const itheima = require('ithei-tools-ddjs')

    格式化时间

    const dtStr = itheima.dateFormat(new Date())
    //结果:2022-03-23 14:05:28
    console.log(dtStr)

    转义 html 中的字符

    //带转换的 html 字符串
    const htmlStr = '<h1 title="abc">我是 h1<span>123&nbsp</span></h1>'
    //调用 htmlEscape 方法进行转换
    const str = idheima.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 字符串

    //带还原的字符串调用 htmlUnEscape 方法进行转换
    const str2 = idheima.htmlUnEscape(str)
    //结果:&lt;h1 title=&quot;abc&quot;&gt;我是 h1&lt;span&gt;123&amp;nbsp&lt;/span&gt;&lt;/h1&gt;
    console.log(str2)

    开源协议

    ISC