Skip to content

Instantly share code, notes, and snippets.

@mrwithersea
Last active January 3, 2018 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrwithersea/db17d6c11dc087fcf3e432d5e8c6a0df to your computer and use it in GitHub Desktop.
Save mrwithersea/db17d6c11dc087fcf3e432d5e8c6a0df to your computer and use it in GitHub Desktop.
Get the prop or return the identity function
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