1.1.3 • Published 3 years ago

oversimplified-express-validator v1.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

oversimplified-express-validator

An oversimplified validator with simple options and an even simpler documentation #usage You can use it as a middleware, in your express app. like :-

import middleware from 'oversimplified-express-validator';
app.post('/', middleware([{name:"email", email:true}, {name:"password", minLength: 8}, {name:"phoneNumber", minLength:10, maxLength:10}, {name:"name", equate:"MrBigFox"}, {name:'processor', includes:["AMD", "Ryzen"], minLength:8, maxLength:20}]), async (req, res) => {
    res.send("posted")
    console.log(req.body);
})

You have to provide an array with objects that are of the form:- {name:"name-of-the-perimeter", ...validators} These are the available validators:-

nametypedescriptionexample
includesarrayIt checks if the provided array of items exists in the given request body data"Ryzen, "Amd"
equateany, but preferably stringIt checks if the provided data equates with the given request body data"MrBigFox"
minLengthnumberIt checks if the given request body data's length is at least equal to the given number8
maxLengthnumberIt checks if the given request body data's length is at most equal to the given number8
emailbooleanIt checks if the given request body data is of the type "email", ie. of the form example@email.comtrue
1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago