itheima-zzy
v1.0.0
Published
提供了日期格式化和HTML转义的功能
Readme
##安装 ''' npm install itheima-zzy '''
##导入 '''js const itheima = require('itheima-zzy') '''
##格式化时间 '''js // 调用dateFormat()对时间进行格式化 const dtStr = itheima.dateFormat(new Date()) // 结果 2026-06-01 16:30:17 console.log(dtStr) '''
##转义HTML中的特殊字符 '''js // 待转换的HTML字符串 const HTMLstr = 'Hello & welcome to "itheima"!'; // 调用HTMLEscape方法进行转换 const str = itheima.HTMLEscape(htmlstr); // 转换的结果 <div class="box">Hello & welcome to "itheima"!</div> console.log(str); '''
##还原HTML中的特殊字符 '''js //待还原的HTML字符串 str2 = itheima.HTMLUnescape(str); //输出的结果是 Hello & welcome to "itheima"! console.log(str2); '''
##开源协议 ISC
