You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
594 B
JavaScript
13 lines
594 B
JavaScript
"use strict";
|
|
|
|
const applyValidators = require("../apply-validators");
|
|
|
|
// NOTE: This will *not* give you access to either the errors or the transformed value! It's typically used for conditional logic in business logic *after* the initial validation has already taken place. This allows for reusing the entire ecosystem of Validatem validators for "does this value match format X, if yes, run this code"-type logic.
|
|
// FIXME: Put this in the documentation instead.
|
|
|
|
module.exports = function (value, rules) {
|
|
let { errors } = applyValidators(value, rules);
|
|
|
|
return (errors.length === 0);
|
|
};
|