1.0.0 • Published 3 years ago

wangxin-npm v1.0.0

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

安装

npm install wangxin-npm

导入

const wangxin = require("wangxin-npm");

格式化时间

// 时间格式化
const dateStr = wangxin.dataFormat(new Date());

转义 HTML 中的特殊字符

const htmlstr = wangxin.htmlEscape(htmlStr);
// 结果 &lth1 title=&quotabc&quot&gt&ltsapn&gt123&ampnbsp;&lt/span&gt你好,我是嫩爹&lt/h1&gt

还原 HTML 中的特殊字符

const htmlstr2 = wangxin.htmlUnEscape(htmlstr2);
// 结果 <h1 title="abc"><sapn>123undefinednbsp;</span>你好,我是嫩爹</h1>

开源协议

ISC

// 我爱详熙