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 - npm Package Compare versions

Comparing version 0.0.4 to 0.0.6

.npmignore

7

lib/index.js

@@ -22,2 +22,9 @@ var defaults = require("./defaults"),

"tester": function() {
return testers.create();
},
/**
*/
get: function(name) {

@@ -24,0 +31,0 @@ return testers.get(name);

11

lib/matchers.js

@@ -8,5 +8,6 @@ var structr = require("structr");

"__construct": function(testers) {
"__construct": function(testers, pos) {
this._testers = testers;
this._source = [];
this._pos = pos !== undefined;
},

@@ -40,10 +41,8 @@

"test": function(value) {
if(!this._source.length) return false;
for(var i = 0, n = this._source.length; i < n; i++) {
var match = this._source[i];
if(!match.test(value)) return false;
if(!match.test(value)) return !this._pos;
}
return true;
return this._pos;
},

@@ -50,0 +49,0 @@

@@ -6,3 +6,4 @@ var structr = require("structr"),

validator = require("validator"),
check = validator.check;
check = validator.check,
toarray = require("toarray");

@@ -15,2 +16,3 @@ module.exports = structr({

"__construct": function(options) {
this._testers = options.testers;

@@ -21,3 +23,3 @@ this.name = options.name;

this._sanitizers = new Sanitizers();
this._is = new Matchers(this._testers);
this._is = new Matchers(this._testers, true);
this._not = new Matchers(this._testers);

@@ -54,5 +56,13 @@

/**
* DEPRECATED
*/
"addSanitizer": function(match, sanitizer) {
"addSanitizer": function() {
this.sanitize.apply(this, arguments);
},
/**
*/
"sanitize": function(match, sanitizer) {
this._sanitizers.add(match, sanitizer);

@@ -66,3 +76,3 @@ return this;

"test": function(value) {
return !!value && this._is.test(value) && !this._not.test(value);
return value !== undefined && this._is.test(value) && !this._not.test(value);
},

@@ -73,2 +83,12 @@

"match": function(options) {
for(var key in options) {
this[key].apply(this, toarray(options[key]));
}
return this;
},
/**
*/
"sanitize": function(value) {

@@ -75,0 +95,0 @@ var newValue = this._is.sanitize(value);

@@ -18,3 +18,11 @@ var structr = require("structr"),

"register": function(name, message) {
return this._source[name] = new Tester({
return this._source[name] = this.create(name, message);
},
/**
*/
"create": function(name, message) {
return new Tester({
testers: this,

@@ -21,0 +29,0 @@ name: name,

{
"name": "verify",
"version": "0.0.4",
"version": "0.0.6",
"description": "```javascript",

@@ -12,7 +12,11 @@ "main": "./lib/index.js",

"structr": "0.2.x",
"comerr": "0.0.x"
"comerr": "0.0.x",
"toarray": "0.0.x"
},
"devDependencies": {},
"devDependencies": {
"mocha": "1.8.x",
"expect.js": "0.2.x"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha --reporter min"
},

@@ -19,0 +23,0 @@ "repository": {

@@ -5,3 +5,3 @@ ```javascript

verify.register("email", "Invalid email").match(/regexp/).len(6, 64);
verify.register("email", "Invalid email").is(/regexp/).len(6, 64);
verify.register("name", "Invalid name").len(2);

@@ -8,0 +8,0 @@ verify.register("phoneNumber", "Invalid phone number").sanitize(/\d+\-\d+\-\d+/, function(number) {

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