"use strict"; const combinator = require("@validatem/combinator"); const validationResult = require("@validatem/validation-result"); const withContext = require("@validatem/with-context"); // TODO: Document that this passes on context module.exports = function ignoreResult(rules) { // TODO: Document the convention of `parseIntoResult`, and that parsing validators can take this from the context to determine whether the result is going to be ignored (which means it may not have to parse in the first place) let rulesWithParsingDisabled = withContext(rules, { parseIntoResult: false }); return combinator((value, applyValidators, context) => { let result = applyValidators(value, rulesWithParsingDisabled, context); return validationResult({ errors: result.errors, newValue: undefined }); }); };