Dingle Validator
Dingle Parameter Validation
Installation
$ npm install --save dingle-validator
Usage
Simply require the dingle validator module and specify a data type:
exportsparamsemail = description: 'Email for the user being registered' required: true validator: email
Custom Errors
To return a custom error you must pass it into the function like so:
exportsparamsemail = description: 'Email for the user being registered' required: true { return ; }
Data Types
You can use any of the following data types from this module:
- string
- boolean
- float
- integer
- date (Returns a date object)
- file (Returns a multer object)
- json (Returns an object from JSON.parse)
- ip
- url
- domain
- base64
- color (Hexidecimal color)
- hex (Hexidecimal number)
- isbn
- isin
- uuid
- mongo (Mongo object id)
- card (Credit or debit card)