JSPM

student-han

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

    时间格式化,和HTMLEscape相关功能

    Package Exports

    • student-han
    • student-han/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 (student-han) 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 student-han
    

    ##导入

    const student = require('student-han')
    

    ##格式化时间

    // 调用时间
    const str = student.dateformat(new Date())
    // 输出结果
    console.log(str);

    ##转义HTML特殊字符

    // 测试一个字符串并接受到htmlStr
    const htmlStr = '<h1 style:"color: red">这是一个测试<span>字符串<span></h1>';
    
    // 调用htmlescape来测试
    const htstr = student.htmlescape(htmlStr);
    
    // 输出结果
    console.log(htstr);

    ##还原HTML特殊字符

    // 测试一段特殊的字符串
    const ahtstr = '&lth1 style:&quotcolor: red&quot&gt这是一个测试&ltspan&gt字符串&ltspan&gt&lt/h1&gt'
    // 根据上一个测试的结果反向测试
    const unhtstr = student.htmlunescape(ahtstr);
    
    // 输出结果
    console.log(unhtstr);

    ##开源协议 ISC