1.0.0 • Published 3 years ago

vwen v1.0.0

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

安装

npm install vwen

导入

const vwen = require("vwen");

格式化时间

// 调用dateFormat方法格式化时间
const dateStr = vwen.dateFormat(new Date());
// 打印结果:dateFormat
console.log(dateStr);

转义 HTML 中的特殊字符

// HTML字符串
const htmlstr = "<h1>123</h1>";
// 调用htmlEscape方法进行转换
const oldstr = vwen.htmlEscape(htmlstr);
// 打印结果:&lt;h1&gt;123&lt;/h1&gt;
console.log(oldstr);

还原 HTML 中的特殊字符

// 待还原的字符串
const newstr = vwen.htmlUnEscape(oldstr);
// 打印的结果:<h1>123</h1>
console.log(newstr);

开源协议

ISC