1.0.0 • Published 1 year ago

testpackage-tools1 v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

安装

 npm install testpackage-tools1

导入

let formateTime = require("./dataformate");

格式化时间

const dtr = formateTime.dateFormat(new Date());

转义 HTML 中的特殊字符

// 转移
var unsafe = '<script>alert("XSS!");</script>';
var safe = formateTime.escapeHtml(unsafe);

反转义 HTML 中的特殊字符

//反转义
const encoded = "&lt;script&gt;alert(&quot;Not XSS!&quot;);&lt;/script&gt;";
var unEscapeHtml = formateTime.unescapeHtml(encoded);

开源协议

ISC
1.0.0

1 year ago