2.2.2 • Published 2 years ago

itheima-toolssse v2.2.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

##安装 ''' npm install itheima-tools

'''

导入

'''js const itheima=require('itheima-tools');

'''

格式化时间

'''js //调用 dateFormat 对时间进行格式化

const dtStr=itheima.dateFormat(new Date());

console.log(dtStr); '''

转义 HTML 中的特殊字符

'''js

//带转换的HTML 字符串

const htmlStr = "这是h1标签123 "

//调用 htmlEscape 方法进行转换

const str = itheima.htmlEscape(htmlStr);

//转换结果是 <h1>这是h1标签<span>123&nbsp;</span></h1>

console.log(str); '''

'''js

//待还原的HTML 字符串 const str2 = itheima.htmlUnEscape(str);

//输出结果 这是h1标签123&nbsp;<\span><\h1> console.log(str2);

开源协议

ISC