1.2.0 • Published 6 years ago
web-xiu v1.2.0
web-xiu 工具函数
good good study, day day up!
效果预览
👉预览地址:请点我!在线预览
工具类别
金额类验证 + 用户信息验证 + 邮箱联系方式验证 ...
工具描述
- 金额类验证
- 用户信息验证
- 邮箱联系方式验证
- 字符串处理
- 数组结构
- 对象解构
- 循环
具体功能实现
代码片段
function html_encode(str) {
var s = '';
if (str.length == 0) return "";
s = str.replace(/&/g, "&");
s = s.replace(/</g, "<");
s = s.replace(/>/g, ">");
s = s.replace(/\s/g, " ");
s = s.replace(/\'/g, "'");
s = s.replace(/\"/g, """);
s = s.replace(/\n/g, "<br/>");
return s;
}
Install
# install dependencies
npm i web-xiu --save
# use dependencies
let webXiu = require("web-xiu")
webxiu.formatDouble(30,2)
For detailed explanation on how things work, checkout the contact me and docs for vue ,docs for ES6.