/
home
/
infinitibizsol
/
.trash
/
node_modules.5
/
express-validator
/
src
/
context-items
/
File Upload :
llllll
Current File: /home/infinitibizsol/.trash/node_modules.5/express-validator/src/context-items/custom-condition.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CustomCondition = void 0; const base_1 = require("../base"); class CustomCondition { constructor(condition) { this.condition = condition; } async run(_context, value, meta) { try { const result = this.condition(value, meta); await result; // if the promise resolved or the result is truthy somehow, then there's no validation halt. if (!result) { // the error thrown here is symbolic, it will be re-thrown in the catch clause anyway. throw new Error(); } } catch (e) { throw new base_1.ValidationHalt(); } } } exports.CustomCondition = CustomCondition;
Copyright ©2k19 -
Hexid
|
Tex7ure