async-validate
Advanced tools
Comparing version 0.12.3 to 0.12.4
@@ -369,2 +369,10 @@ ## Guide | ||
##### Resolve | ||
* `resolve <function>`: Rule location function. | ||
A function that may be declared to conditionally determine the rule to use for a given object, if is invoked *synchronously* in the scope of the object being validated. It should inspect the object and return a rule to use for that particular object. | ||
This is typically used to allow rules to be conditional on a property of an object, for example an object may have a `type` field that determines the type or class of object and validation needs to change for the different types. | ||
##### Test | ||
@@ -371,0 +379,0 @@ |
@@ -0,3 +1,7 @@ | ||
[![Build Status](https://travis-ci.org/tmpfs/async-validate.svg)](https://travis-ci.org/tmpfs/async-validate) | ||
[![npm version](http://img.shields.io/npm/v/async-validate.svg)](https://npmjs.org/package/async-validate) | ||
[![Coverage Status](https://coveralls.io/repos/tmpfs/async-validate/badge.svg?branch=master&service=github&v=1)](https://coveralls.io/github/tmpfs/async-validate?branch=master) | ||
Asynchronous validation for [node](http://nodejs.org) and the browser. | ||
Examples are in [EXAMPLE](/EXAMPLE.md) and the [example directory](/doc/example). |
@@ -134,2 +134,6 @@ var iterator = require('./iterator') | ||
if(typeof rule.resolve === 'function') { | ||
rule = rule.resolve.call(value); | ||
} | ||
// default value placeholder | ||
@@ -136,0 +140,0 @@ if(value === undefined |
{ | ||
"name": "async-validate", | ||
"description": "Asynchronous validation for node and the browser", | ||
"version": "0.12.3", | ||
"version": "0.12.4", | ||
"author": "muji <noop@xpm.io>", | ||
@@ -10,3 +10,3 @@ "license": "MIT", | ||
"type": "git", | ||
"url": "https://github.com/freeformsystems/async-validate.git" | ||
"url": "https://github.com/tmpfs/async-validate.git" | ||
}, | ||
@@ -27,2 +27,3 @@ "keywords": [ | ||
"chai": "~3.2.0", | ||
"coveralls": "~2.11.6", | ||
"istanbul": "~0.3.17", | ||
@@ -41,3 +42,4 @@ "mocha": "~2.3.2", | ||
"test": "NODE_ENV=test mocha test/global ${SPEC:-test/spec}", | ||
"cover": "NODE_ENV=test istanbul cover _mocha -- test/global ${SPEC:-test/spec}" | ||
"cover": "NODE_ENV=test istanbul cover _mocha -- test/global ${SPEC:-test/spec}", | ||
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" | ||
}, | ||
@@ -51,3 +53,3 @@ "mdp": { | ||
"toc": "Table of Contents", | ||
"base": "https://github.com/freeformsystems/async-validate", | ||
"base": "https://github.com/tmpfs/async-validate", | ||
"partial": [ | ||
@@ -54,0 +56,0 @@ { |
@@ -33,2 +33,3 @@ Table of Contents | ||
* [Match](#match) | ||
* [Resolve](#resolve) | ||
* [Test](#test) | ||
@@ -81,5 +82,9 @@ * [Whitespace](#whitespace) | ||
[<img src="https://travis-ci.org/tmpfs/async-validate.svg" alt="Build Status">](https://travis-ci.org/tmpfs/async-validate) | ||
[<img src="http://img.shields.io/npm/v/async-validate.svg" alt="npm version">](https://npmjs.org/package/async-validate) | ||
[<img src="https://coveralls.io/repos/tmpfs/async-validate/badge.svg?branch=master&service=github&v=1" alt="Coverage Status">](https://coveralls.io/github/tmpfs/async-validate?branch=master). | ||
Asynchronous validation for [node](http://nodejs.org) and the browser. | ||
Examples are in [EXAMPLE](https://github.com/freeformsystems/async-validate/blob/master/EXAMPLE.md) and the [example directory](https://github.com/freeformsystems/async-validate/blob/master/doc/example). | ||
Examples are in [EXAMPLE](https://github.com/tmpfs/async-validate/blob/master/EXAMPLE.md) and the [example directory](https://github.com/tmpfs/async-validate/blob/master/doc/example). | ||
@@ -193,3 +198,3 @@ ## Install | ||
Rules are functions that perform validation of a value, they are invoked in the scope of a rule instance ([file](https://github.com/freeformsystems/async-validate/blob/master/lib/rule.js), [api docs](#rule)). | ||
Rules are functions that perform validation of a value, they are invoked in the scope of a rule instance ([file](https://github.com/tmpfs/async-validate/blob/master/lib/rule.js), [api docs](#rule)). | ||
@@ -341,3 +346,3 @@ A rule function can access all relevant properties and methods using `this` and should [raise](#raise) an error if `this.value` fails a validation test, see [errors](#errors). Rule functions may raise multiple errors for different validation failures. | ||
See the [system schema](https://github.com/freeformsystems/async-validate/blob/master/system.js). | ||
See the [system schema](https://github.com/tmpfs/async-validate/blob/master/system.js). | ||
@@ -495,2 +500,10 @@ ##### Type Identifier | ||
##### Resolve | ||
* `resolve <function>`: Rule location function. | ||
A function that may be declared to conditionally determine the rule to use for a given object, if is invoked *synchronously* in the scope of the object being validated. It should inspect the object and return a rule to use for that particular object. | ||
This is typically used to allow rules to be conditional on a property of an object, for example an object may have a `type` field that determines the type or class of object and validation needs to change for the different types. | ||
##### Test | ||
@@ -582,5 +595,5 @@ | ||
Static plugins are mapped to [type identifiers](#type-identifiers) and instance plugins may be used to extend [Rule](#rule) which is useful for sharing functionality across rule plugins, see the [util plugins](https://github.com/freeformsystems/async-validate/blob/master/plugin/util). | ||
Static plugins are mapped to [type identifiers](#type-identifiers) and instance plugins may be used to extend [Rule](#rule) which is useful for sharing functionality across rule plugins, see the [util plugins](https://github.com/tmpfs/async-validate/blob/master/plugin/util). | ||
See [plugin rule](#plugin-rule) for an example and [plugin](https://github.com/freeformsystems/async-validate/blob/master/plugin) contains the plugins that ship with this package. | ||
See [plugin rule](#plugin-rule) for an example and [plugin](https://github.com/tmpfs/async-validate/blob/master/plugin) contains the plugins that ship with this package. | ||
@@ -674,3 +687,3 @@ The important point to remember is that for helper methods assign to `this` and for static rule functions (located by `type`) assign to `this.main` in the plugin. | ||
See the [vars test](https://github.com/freeformsystems/async-validate/blob/master/test/spec/vars.js) and [model fixture](https://github.com/freeformsystems/async-validate/blob/master/test/fixtures/model.js) for an example. | ||
See the [vars test](https://github.com/tmpfs/async-validate/blob/master/test/spec/vars.js) and [model fixture](https://github.com/tmpfs/async-validate/blob/master/test/fixtures/model.js) for an example. | ||
@@ -681,3 +694,3 @@ #### State | ||
See the [state example](https://github.com/freeformsystems/async-validate/blob/master/doc/example/state.js). | ||
See the [state example](https://github.com/tmpfs/async-validate/blob/master/doc/example/state.js). | ||
@@ -1002,3 +1015,3 @@ ### Messages | ||
Generate [EXAMPLE](https://github.com/freeformsystems/async-validate/blob/master/EXAMPLE.md) (requires [mdp](https://github.com/freeformsystems/mdp)): | ||
Generate [EXAMPLE](https://github.com/tmpfs/async-validate/blob/master/EXAMPLE.md) (requires [mdp](https://github.com/freeformsystems/mdp)): | ||
@@ -1019,3 +1032,3 @@ ``` | ||
Everything is [MIT](http://en.wikipedia.org/wiki/MIT_License). Read the [license](https://github.com/freeformsystems/async-validate/blob/master/LICENSE) if you feel inclined. | ||
Everything is [MIT](http://en.wikipedia.org/wiki/MIT_License). Read the [license](https://github.com/tmpfs/async-validate/blob/master/LICENSE) if you feel inclined. | ||
@@ -1022,0 +1035,0 @@ Generated by [mdp(1)](https://github.com/freeformsystems/mdp). |
Sorry, the diff of this file is not supported yet
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
216430
190
4574
1034
7