1.0.0 • Published 3 years ago
akun-tools v1.0.0
安装
npm install akun-tools
导入
const akun = require('akun-tools')
格式化时间
const dt = akun.dateFormat(new Date())
转义并还原HTML中的特殊字符
const htmlStr = '<h1 title="abc">这是h1标签<span>123 </span></h1>'
// 定义的待转换的字符串
const unhtmlStr = dateFormat.htmlEscape(htmlStr)
// 转换字符串
console.log(unhtmlStr);//<h1 title="abc">这是h1标签<span>123&nbsp</span></h1>
console.log(htmlStr);//<h1 title="abc">这是h1标签<span>123 </span></h1>
console.log(dateFormat.htmlUnEscape(unhtmlStr));//<h1 title="abc">这是h1标签<span>123 </span></h1>
开源协议
ISC
1.0.0
3 years ago