New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

dingle-validator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dingle-validator

Dingle Parameter Validation

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

Dingle Validator

Dingle Parameter Validation

Installation

$ npm install --save dingle-validator

Usage

Simply require the dingle validator module and specify a data type:

exports.params.email = {
	description: 'Email for the user being registered',
	required: true,
	validator: require('dingle-validator').email
}

Custom Errors

To return a custom error you must pass it into the function like so:

exports.params.email = {
	description: 'Email for the user being registered',
	required: true,
	validator: function(object){
		return require('dingle-validator').email(object, 'You must enter a valid email address!');	
	}
}

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)
  • email
  • ip
  • url
  • domain
  • base64
  • color (Hexidecimal color)
  • hex (Hexidecimal number)
  • isbn
  • isin
  • uuid
  • mongo (Mongo object id)
  • card (Credit or debit card)

Keywords

dingle

FAQs

Package last updated on 01 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts