Created
January 11, 2019 18:31
-
-
Save igorfelipee/d673b9ad25211a163a244debe19b37bc to your computer and use it in GitHub Desktop.
runValidationIfFieldExists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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