1.0.0 • Published 2 years ago

abin-tools v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

安装

npm install abin-tools

导入

const abinTools = require('./abin-tools/index')

格式化时间

const dtStr = abinTools.dataFormat(new Date())
console.log(dtStr);

转义HTML字符串

const htmlstr = '<h1 title="abc">这是h1标签<span>123&npsp;</span></h1>'
let newHTML = abinTools.htmlEscape(htmlstr);
console.log(newHTML); //输出:&lt;h1 title=&quot;abc&quot;&gt;这是h1标签&lt;span&gt;123&amp;npsp;&lt;/span&gt;&lt;/h1&gt;
let oldHTML = abinTools.htmlUnEscape(newHTML);
console.log(oldHTML);//输出:<h1 title="abc">这是h1标签<span>123&npsp;</span></h1>

开源协议

ISC