Skip to content

Instantly share code, notes, and snippets.

@bee0060
Last active November 13, 2020 02:41
Show Gist options
  • Save bee0060/9d181cb200183f484d7eeb400cf6ae11 to your computer and use it in GitHub Desktop.
Save bee0060/9d181cb200183f484d7eeb400cf6ae11 to your computer and use it in GitHub Desktop.
small helpful js functions
const predicate = (pred, whenTrueFn, whenFalseReturnValue) => (...args) => {
if (!pred(...args)) {
return whenFalseReturnValue
}
return whenTrueFn(...args)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment