"use strict"; const validationResult = require("./"); const ValidationError = require("@validatem/error"); const { validateValue } = require("@validatem/core"); function nonsenseValidator(value) { return validationResult({ errors: [ new ValidationError("Some nonsense"), new ValidationError("Some more nonsense"), ], newValue: value * 2 /* This will currently get lost into the void, because there are validation errors - a future version of Validatem may expose this "partial result", though */ }); } let result = validateValue(21, nonsenseValidator); /* AggregrateValidationError: One or more validation errors occurred: - At (root): Some nonsense - At (root): Some more nonsense */