async-validate
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -6,3 +6,3 @@ // assign a function to a rule | ||
expected: 'foo', | ||
validator: function(cb) { | ||
test: function(cb) { | ||
if(this.value !== this.expected) { | ||
@@ -9,0 +9,0 @@ this.raise( |
@@ -56,3 +56,3 @@ ## Guide | ||
foo: 'bar', | ||
validator: function(cb) { | ||
test: function(cb) { | ||
console.log(this.foo); | ||
@@ -180,2 +180,6 @@ // if this.value has error condition call this.raise() | ||
##### Test | ||
The test function to use for rule validation. | ||
##### Additional | ||
@@ -182,0 +186,0 @@ |
@@ -109,6 +109,6 @@ var iterator = require('./iterator') | ||
if(typeof rule === 'function') { | ||
rule.validator = rule; | ||
}else if(typeof rule.validator !== 'function') { | ||
rule.test = rule; | ||
}else if(typeof rule.test !== 'function') { | ||
// validator plugin functions are static methods | ||
rule.validator = Rule[rule.type]; | ||
rule.test = Rule[rule.type]; | ||
} | ||
@@ -119,3 +119,3 @@ | ||
if(typeof rule.validator !== 'function') { | ||
if(typeof rule.test !== 'function') { | ||
throw new Error(format('Unknown rule type %s', rule.type)); | ||
@@ -256,3 +256,3 @@ } | ||
// invoke rule validation function | ||
rule.validator.call(validator, onValidate); | ||
rule.test.call(validator, onValidate); | ||
@@ -259,0 +259,0 @@ }, function(err, results) { |
{ | ||
"name": "async-validate", | ||
"description": "Asynchronous validation for node and the browser", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"author": "muji <noop@xpm.io>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -20,2 +20,3 @@ Table of Contents | ||
* [Type Identifier](#type-identifier) | ||
* [Test](#test) | ||
* [Additional](#additional) | ||
@@ -80,3 +81,3 @@ * [Fields](#fields) | ||
* [Developer](#developer) | ||
* [Test](#test) | ||
* [Test](#test-1) | ||
* [Spec](#spec) | ||
@@ -185,3 +186,3 @@ * [Cover](#cover) | ||
foo: 'bar', | ||
validator: function(cb) { | ||
test: function(cb) { | ||
console.log(this.foo); | ||
@@ -309,2 +310,6 @@ // if this.value has error condition call this.raise() | ||
##### Test | ||
The test function to use for rule validation. | ||
##### Additional | ||
@@ -821,3 +826,3 @@ | ||
expected: 'foo', | ||
validator: function(cb) { | ||
test: function(cb) { | ||
if(this.value !== this.expected) { | ||
@@ -824,0 +829,0 @@ this.raise( |
@@ -13,3 +13,3 @@ var expect = require('chai').expect | ||
foo: 'bar', | ||
validator: function(cb) { | ||
test: function(cb) { | ||
expect(this.foo).to.eql('bar'); | ||
@@ -16,0 +16,0 @@ cb(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
172975
1404