Skip to content

Instantly share code, notes, and snippets.

@igorfelipee
Created January 11, 2019 18:31
Show Gist options
  • Save igorfelipee/d673b9ad25211a163a244debe19b37bc to your computer and use it in GitHub Desktop.
Save igorfelipee/d673b9ad25211a163a244debe19b37bc to your computer and use it in GitHub Desktop.
runValidationIfFieldExists
export const runValidationIfFieldExists = validationFunction => (objectPath, object) => {
const NOT_FOUND_PATH_IN_OBJECT = null;
const checkIfObjectPathExistis = pathOr(NOT_FOUND_PATH_IN_OBJECT, objectPath, object);
return checkIfObjectPathExistis ? validationFunction(checkIfObjectPathExistis) : '';
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment