Last active
January 3, 2018 15:49
-
-
Save mrwithersea/db17d6c11dc087fcf3e432d5e8c6a0df to your computer and use it in GitHub Desktop.
Get the prop or return the identity function
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
const propOrSelf = R.curry((prop, value) => R.when( | |
R.propSatisfies(R.complement(R.isNil), prop), | |
R.prop(prop) | |
)(value)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment