1.0.0 • Published 1 year ago

itheima-examination v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

安装

npm install itheima-examination

导入

const itheima = require('itheima-tools')

格式化时间

// 调用dateFormat将时间格式化
const day  = it.dateFormate(new Date())

转移HTML中特殊字符

// 带转换的字符串
const htmlStr = '<h1 title="abc">这是h1标签<span>123&nbsp;</span<</h1>'
// 调用 htmlEscape 方法转换
const str = it.htmlEscape(htmlStr)
// 转换结果
console.log(str);

还原HTML中的特殊字符

// 待还原的HTML字符串
const htmlstr = it.htmlUnEscape(str)
// 输出结果
console.log(htmlstr);

开源协议

ISC