wwx-tools-xgdsd

提供了格式化时间、HTMLEscape相关的功能

Usage no npm install needed!

<script type="module">
  import wwxToolsXgdsd from 'https://cdn.skypack.dev/wwx-tools-xgdsd';
</script>

README

安装

npm i wwx-tools-5

导入

const itheina =require('./wwx-tools-5')

格式化日期

const dtStr = itheina.dateFormat(new Date())
console.log(dtStr); // 2020-12-04 14:50:13

测试 转译

const htmlStr = '<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>'
const str = itheina.htmlEscape(htmlStr)
console.log(str); // &lt;h1 title=&quot;abc&quot;&gt;这是h1标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;amp;nbsp;&lt;/span&gt;&lt;/h1&gt;

测试 还原

const str2 = itheina.htmlUnEscape(str)
console.log(str2); // <h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>  

开源协议

ISC