added all files

This commit is contained in:
DJj123dj
2021-11-14 09:12:55 +01:00
commit 918f5f4243
2793 changed files with 298038 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
import type { Predicate } from '../predicates/predicate';
/**
Operator which inverts the following validation.
@hidden
@param predictate - Predicate to wrap inside the operator.
*/
export declare const not: (predicate: Predicate) => Predicate;
+28
View File
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.not = void 0;
const random_id_1 = require("../utils/random-id");
const predicate_1 = require("../predicates/predicate");
/**
Operator which inverts the following validation.
@hidden
@param predictate - Predicate to wrap inside the operator.
*/
const not = (predicate) => {
const originalAddValidator = predicate.addValidator;
predicate.addValidator = (validator) => {
const { validator: fn, message, negatedMessage } = validator;
const placeholder = random_id_1.default();
validator.message = (value, label) => (negatedMessage ?
negatedMessage(value, label) :
message(value, placeholder).replace(/ to /, '$&not ').replace(placeholder, label));
validator.validator = (value) => !fn(value);
predicate[predicate_1.validatorSymbol].push(validator);
predicate.addValidator = originalAddValidator;
return predicate;
};
return predicate;
};
exports.not = not;