Approvejs Versions Save

A simple JavaScript validation library that doesn't interfere

v3.1.2

6 years ago

Improved ignoreNull config setting to check for falsy values instead of jus null

v3.1.1

7 years ago

Updated documentation links

v3.1.0

7 years ago

Added ignoreNull property for handling null values.

Usage:

Test will pass

var rules = {
    required: true,
    email: true,
    ignoreNull: true
};

var result = approve.value(null, rules);

Test will fail

var rules = {
    required: true,
    email: true
};

var result = approve.value(null, rules);

v3.0.2

7 years ago

Fix for issue #11

v3.0.1

7 years ago

Numeric test now accepts negative values.

v3.0.0

7 years ago
  • Added error filtering
  • Added test outcome properties

Please read upgrade guide for this release.

v2.1.0

7 years ago

Added test cancellation:

By default, ApproveJS will continue testing every rule and return all tests' error messages. For example:

var rules = {
   required: true,
   email: true
};

var result = approve.value('', rules);

The above code will check whether the value is present (required = true) and whether it is a valid email address (email = true). Should the value fail the required rule, ApproveJS will continue and also test the email rule, returning errors for both tests.

It makes sense though, that if the value fails the required test, that it will automatically fail the email test, so you might want to stop testing and return only the errors for the failed required test. For this we use the stop property which will stop all testing after the first failed rule, i.e.

var rules = {
   stop: true,
   required: true,
   email: true
};

var result = approve.value('', rules);

Now, should the required rule fail, ApproveJS will stop all testing and return only the error messages for the required rule.

Note that rules are tested in the order in which they appear in the rule object, i.e.

var rules = {
   stop: true,
   required: true,
   email: true
};

In the code above, required will be tested first, and email second whereas in the code below, email will be tested first, and required second.

var rules = {
   stop: true,
   email: true,
   required: true
};

v2.0.0

7 years ago
  • Implemented Rollup
  • Updated date test to include format when testing

v1.1.2

7 years ago

Converted DOS line endings (\r\n) to Unix line endings (\n).

v1.1.1

7 years ago

Added missing ignore case flags