oarsjs
v1.0.5
Published
a JavaScript function lib
Downloads
1
Readme
OarsJS
一个函数库,包含一些常用函数。
安装
npm
npm install OarsJS
import oars from oarsjs
oars.foo()
CDN
<script src="https://unpkg.com/oarsjs/dist/oars.js"></script>
<script>
this.oars.foo()
</script>
使用指南
build_query
将对象序列化为查询字符串
let obj = {
name:'foo',
age:23
}
oars.build_query(obj) //return 'name=foo&age=23'
reg
常用正则表达式,包含邮箱、手机号等的判断
//第一个参数传入需要判断的规则,第二个参数传入需要判断的数据
oars.reg('email','[email protected]'); //return true
oars.reg('phone','1122uujjj'); //return false
oars.reg('ip','192.168.10.1'); // return true
所有支持的规则
- phone(手机号)
- email(邮箱)
- url(网址)