Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return ({ key, newValue, oldValue, changes, content }) => {
let validator = validationMap[key];
if (isEmpty(validator)) {
return true;
}
if (isArray(validator)) {
return handleMultipleValidations(validator, { key, newValue, oldValue, changes, content });
}
let validation = validator(key, newValue, oldValue, changes, content);
return isPromise(validation) ? validation.then(wrapInArray) : [validation];
};
}