# rulesInfo : enum
需要校验的类型
Properties
Name | Type | Default |
---|---|---|
mobile | ValidType | {"label":"手机号","rules":{}} |
tel | ValidType | {"label":"座机号","rules":{}} |
ValidType | {"label":"邮箱","rules":{}} | |
bank | ValidType | {"label":"银行卡号","rules":{}} |
CN | ValidType | {"label":"中文","rules":{}} |
CName | ValidType | {"label":"中文名","rules":{}} |
idCard | ValidType | {"label":"身份证号","rules":{}} |
number | ValidType | {"label":"数字","rules":{}} |
url | ValidType | {"label":"url地址","rules":{}} |
# validator(type, val) ⇒ boolean
校验是否符合中文名
Returns: boolean
-
true/false
Author: liukun 919590347@qq.com
Param | Type | Description |
---|---|---|
type | ValidType | 需要校验的类型 |
val | string | 需要校验的值 |
Example
import { validator } from '@wont/utils'
validator('mobile', '13233333333') // returns true
// bank
// 范校验,具体:https://gist.github.com/yanweijia/7fea45eab57a0ff355d71546411b004a
// 银行卡生成测试:https://ddu1222.github.io/bankcard-validator/bcBuilder.html
validator('bank', '4026589624604900') // returns true
// idCard
// 在线生成:https://welefen.com/lab/identify
validator('idCard', '6125251996060691351')
← toFirstCase winOpen →