JSPM

itheima-tools-freddy

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

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

    Package Exports

    • itheima-tools-freddy
    • itheima-tools-freddy/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-tools-freddy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    ##安装

    npm install itheima-tools-freddy
    

    ##导入

    const itheima = require("itheima-tools");

    ##格式化时间

    const dtStr = itheima.dateFormat(new Date());
    // 结果 2022-02-15,21:28:00
    console.log(dtStr);
    const str = "<h1>这是个测试字段</h1>";
    const htmlStr = itheima.htmlEscape(str);
    // 结果 &lt;h1&gt;这是个测试字段&lt;/h1&gt;
    console.log(htmlStr);

    ##还原 HTML 中的特殊字符

    const str = "&lt;h1&gt;这是个测试字段&lt;/h1&gt;";
    const htmlStr = itheima.htmlUnEscape(str);
    // 结果 <h1>这是个测试字段</h1>
    console.log(htmlStr);