1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.StandardValidation = void 0;
|
4 | const utils_1 = require("../utils");
|
5 | class StandardValidation {
|
6 | constructor(validator, negated, options = []) {
|
7 | this.validator = validator;
|
8 | this.negated = negated;
|
9 | this.options = options;
|
10 | }
|
11 | async run(context, value, meta) {
|
12 | const result = this.validator(utils_1.toString(value), ...this.options);
|
13 | if (this.negated ? result : !result) {
|
14 | context.addError(this.message, value, meta);
|
15 | }
|
16 | }
|
17 | }
|
18 | exports.StandardValidation = StandardValidation;
|