Last active
November 13, 2020 02:41
-
-
Save bee0060/9d181cb200183f484d7eeb400cf6ae11 to your computer and use it in GitHub Desktop.
small helpful js functions
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 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