6.6.6 • Published 3 years ago
rainzth v6.6.6
安装方式
npm install rainzth
导入方式
const rainzth = require('rainzth')
格式化时间dateChange
//调用dateChange对时间进行格式化
const dt = rainzth.dateChange(new Date())
// 结果 2021-01-01 00:00:01
console.log(dt)
转义HTML中的特殊字符htmlChange
//给出待转化的字符
const str = '<h1 title="abc">这是h1标签<span>123 </span></h1>'
// 转义
const str_change= rainzth.htmlChange(str)
console.log(str_change)
// 转化结果
//<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>
还原HTML中的特殊字符
const str = rainzth.htmlRecover(str_change)
//此处str_change是上面已转义的,此处拿来借用
console.log(str2)
// 输出的结果 <h1 title="abc">这是h1标签<span>123 </span></h1>
开源协议
ISC