1.0.0 • Published 1 year ago
it_linlin v1.0.0
安装
npm install it_linlin
导入
const it_linlin = require('it_linlin')
格式化时间
// 调用 dataFormat 对时间进行格式化
const dtStr= it_linlin.dateFormat(new Date())
// 结果:2023-03-02 12:20:24
console.log(dtStr);
转义 HTML 中的特殊字符
// 定义待转换的HTML字符串
const htmlstr = '<h1 title="abc">H1标签<span>123 </span></h1>'
// 调用htmlEscape方法进行转换
const str = it_linlin.htmlEscape(htmlstr)
console.log(str);
还原 HTML 中的特殊字符
// 待还原的HTML字符串
const str2 = it_linlin.htmlUnEscape(str)
console.log(str2);
开源协议
ISC
1.0.0
1 year ago