1.0.0 • Published 4 years ago
ls-lstools v1.0.0
1.安装
npm i ls-tools
2.引入
const ls = require('./ls-tools')
3.日期格式化
const dtStr = ls.dateFormat(new Date())
console.log(dtStr);
//结果 2020-10-17 14:03:23
4.转译
const htmlStr = '<h1 title="abc">这是h1<span>123 </span></h1>'
const str = ls.htmlEscape(htmlStr)
console.log(str);
//结果 <h1 title="abc">这是h1<span>123&nbsp;</span></h1>
5.还原
const str2 = ls.htmlUnEscape(str)
console.log(str2);
//结果 <h1 title="abc">这是h1<span>123 </span></h1>
6.开源协议
ISC
1.0.0
4 years ago