2.0.5 • Published 1 year ago

mevn-validator v2.0.5

Weekly downloads
13
License
MIT
Repository
github
Last release
1 year ago

npm version

Validator For Express

  • Install the package npm i mevn-validator
  • The Validator must be instatiated with the new KeyWord
   const Validator = require('mevn-validator')

   // Create a validator instance
   let validate = new Validator(fields: Object, rules: Object)
   validate.validate()
   .then(valid => {
       // do something when the validation passes
   })
   .catch(messages => {
       // You would probably need to send this to the user
       // the messages contains the error messages
   })

   // OR like a cool kid 😎
   new Validator(fields: Object, rules: Object).then(....).catch(...).finally(...)
  • Rules are separted by | e.g field: required|email. The field under validation must be available and be a valid E-mail Address

Available rules

  1. Required

  • Ensures that the field under validation is available field: required
  1. String

  • The field under validation must be a valid String field: string
  1. Email

  • The field under validation must be a valid String field: email
  1. Min:length

  • The field under validation must be more than the given length field: min:10
  1. Max:length

  • The field under validation must be less than the given length field: max:20

    More rules and Docs coming soon. Contributions are welcome

2.0.3

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.0-beta

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago