Add a global "no heuristics" flag for validator debugging
This commit is contained in:
parent
3298399243
commit
d610cad10b
|
@ -12,7 +12,12 @@ module.exports = function applyValidators(value, rules, context = {}) {
|
|||
let normalizedRules = normalizeRules(rules, { normalizeObjects: true });
|
||||
let validator = composeRules.compose(normalizedRules);
|
||||
|
||||
let { errors, newValue } = validator(value, context);
|
||||
// FIXME: Document this option!
|
||||
let finalContext = (process.env.VALIDATEM_NO_HEURISTICS === "1")
|
||||
? { ...context, __validatemNoHeuristics: true }
|
||||
: context;
|
||||
|
||||
let { errors, newValue } = validator(value, finalContext);
|
||||
|
||||
// NOTE: We mutate the error here, because Error objects are not safely cloneable
|
||||
for (let error of errors) {
|
||||
|
|
Loading…
Reference in a new issue