Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 1x 1x 1x 1x 405x 62x 451x 22x 1x 21x | 'use strict';
/*
* adonis-validator
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
const indicative = require('indicative');
const Validation = require('../Validation');
const { ValidationException, InvalidArgumentException } = require('../Exceptions');
module.exports = {
validateAll: (...params) => new Validation(...params).runAll(),
validate: (...params) => new Validation(...params).run(),
sanitize: (...params) => indicative.sanitize(...params),
rule: indicative.rule,
is: indicative.is,
sanitizor: indicative.sanitizor,
configure: indicative.configure,
formatters: indicative.formatters,
extend: function (rule, fn) {
if (typeof fn !== 'function') {
throw InvalidArgumentException.invalidParameter(
'Validator.extend expects 2nd parameter to be a function',
fn,
);
}
indicative.validations[rule] = fn;
},
ValidationException,
};
|