Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

verify

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

verify

```javascript

  • 0.0.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
163
decreased by-3.55%
Maintainers
1
Weekly downloads
 
Created
Source

var verify = require("verify")();

verify.register("email", "Invalid email").is(/regexp/).len(6, 64);
verify.register("name", "Invalid name").len(2);
verify.register("phoneNumber", "Invalid phone number").sanitize(/\d+\-\d+\-\d+/, function(number) {
	return number.replace(/-/g, "");
})
verify.register("fullName", "Invalid full name").is("name");


//don't throw an error if validation 
verify.throwsError(false);

var options = {
	phoneNumber: "994-433-3444",
	email: "email@email.com",
	fullName: "Wu"
}


if(verify.that(options).has("email", "phoneNumber", "fullName").sanitize()) {
	console.log(options.phoneNumber); //994443344
}

API

verify(options)
- `throwsError` - TRUE if the validation library throws an error if one occurs
chain verify.register(name, message)

registers a new verifiable item

chain verify.get(name)

returns a validator chain that's already registered

Chain API

chain.match(fnOrRegexp)

check against a given value

chain.sanitize(check, fn)

sanitizes the value based on the check.

FAQs

Package last updated on 01 Mar 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc