1.0.0 • Published 2 years ago

itheima-tools-zwtest v1.0.0

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

##安装方式

npm install itheima-tools-zw

##导入方式

let itheima = require('./ithemima-tools')

##格式化时间

// 调用dateFormat方法
let result1 = itheima.dateFormat(new Date())

##转义HTML中的特殊字符

//定义带有特殊字符的字符串
let str = '<h1 style="color:red;">你好!&copy;<span>小黄!</span></h1>'
//将转移后的结果给result2
let result2 = itheima.htmlEscape(str)
//转移后的结果:&lth1 style=&quotcolor:red;&quot&gt你好!&ampcopy;&ltspan&gt小黄!&lt/span&gt&lt/h1&gt

##还原HTML中的特殊字符

//调用还原转义的方法,将转移后的字符串传入
let result3 = itheima.htmlUnEscape(result2)
console.log(result3)
//还原后的输出结果:<h1 style="color:red;">你好!&copy;<span>小黄!</span></h1>

##开源协议

ISC