2.0.7 • Published 2 months ago

wewevalidator v2.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

wewevalidator

中文

npm npm bundle size npm GitHub

install

npm install wewevalidator
# common JS
const wewevalidator = require('wewevalidator')
# es6
import wewevalidator from 'wewevalidator'

use

// phone
const phone = '15507810249'
const value = wewevalidator.verify(phone, 'phone')

// telPhone
const telPhone = '0571-4340259'
const value = wewevalidator.verify(telPhone, 'telPhone')

// email
const email = 'yanglu4340@gmail.com'
const value = wewevalidator.verify(email, 'email')

// password
const password = 'helloWorld888'
const value = wewevalidator.verify(password, 'password')

// dateTime
const dateTime = '2020-11-03'
const value = wewevalidator.verify(dateTime, 'dateTime')

// identityCard
const identityCard = '43062319181212003X'
const value = wewevalidator.verify(identityCard, 'identityCard')

// website
const url = 'www.baidu.com'
const value = wewevalidator.verify(url, 'website')

// taxnum
const taxnum = '259595959529592'
const value = wewevalidator.verify(taxnum, 'taxnum')

// isNum
const temp = '259595'
const value = wewevalidator.verify(temp, 'isNum')

// isImg
const temp = 'jpg'
const value = wewevalidator.verify(temp, 'isImg')

// isVideo
const temp = 'mp4'
const value = wewevalidator.verify(temp, 'isVideo')

// isAudio
const temp = 'mp3'
const value = wewevalidator.verify(temp, 'isAudio')

// isLetter
const temp = 'mp3'
const value = wewevalidator.verify(temp, 'isLetter')

// isNumLetter
const temp = 'mp3'
const value = wewevalidator.verify(temp, 'isNumLetter')

// isHanzi
const temp = '张三'
const value = wewevalidator.verify(temp, 'isHanzi')

// verify length
const password = 'helloWorld888'
const limitLength = 10
const value = wewevalidator.verify(password, 'password', limitLength)

// verify general fields
// input label name,example: verify (value, '地区')
const address = '杭州市'
const value = wewevalidator.verify(address, '地区')

attr explain

  1. typeArr : verify attr array
  2. typeKeyValue : verify attr key and value

function

functionparameterdefaultrequireddescription
verifyvaluestringrequireda string value needs to verify
verifykeystringoptionalkey attr
verifylimitLengthnumberoptionala number limit value's length
2.0.7

2 months ago

2.0.6

8 months ago

1.0.1

2 years ago

1.0.0

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

0.0.5

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago