1.0.0 • Published 3 years ago
student-han v1.0.0
##安装
npm install student-han
##导入
const student = require('student-han')
##格式化时间
// 调用时间
const str = student.dateformat(new Date())
// 输出结果
console.log(str);
##转义HTML特殊字符
// 测试一个字符串并接受到htmlStr
const htmlStr = '<h1 style:"color: red">这是一个测试<span>字符串<span></h1>';
// 调用htmlescape来测试
const htstr = student.htmlescape(htmlStr);
// 输出结果
console.log(htstr);
##还原HTML特殊字符
// 测试一段特殊的字符串
const ahtstr = '<h1 style:"color: red">这是一个测试<span>字符串<span></h1>'
// 根据上一个测试的结果反向测试
const unhtstr = student.htmlunescape(ahtstr);
// 输出结果
console.log(unhtstr);
##开源协议 ISC
1.0.0
3 years ago