1.0.0 • Published 3 years ago
itheima-text v1.0.0
安装
npm install itheima-text
导入
const itheima=require('itheima-text')
格式化时间
//调用dateFormat对时间进行格式化
const Str= m.dateFormat(dt)
//结果 2021-06-04 21-04-57
console.log(Str);
转义HTML中的特殊字符
//待转换的HTML字符串
const html="<h1 style=''> <span> :;</span></h1>"
const dd= m.htmlEScape(html)
//结果 <h1 style=''> <span>&nbsp:;</span></h1>
console.log(dd);
还原HTML中的字符串
//待还原的HTML字符串
const DT= m.htmlunEScape(dd)
//结果 <h1 style=''> <span> :;</span></h1>
console.log(DT);
开源协议
ISC
1.0.0
3 years ago