"use strict"; const aggregrateErrors = require("../aggregrate-errors"); module.exports = function createValidationMethod(validationFunction) { return function (... args) { let { errors, newValue } = validationFunction(... args); let aggregratedError = aggregrateErrors(errors); if (aggregratedError != null) { throw aggregratedError; } else { return newValue; } }; };