Created
October 29, 2018 21:55
-
-
Save MeetMartin/e495c651bcf4bfd7794939744c980f3a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import match from 'conditional-expression'; | |
match('funny joke') | |
.equals('sad').then('I am false') | |
.with(/[a-z]/).then('I am true and I am the result') | |
.includes('joke').then('I am true but I am not evaluated') | |
.else('I just execute everything'); | |
// returns 'I am true and I am the result' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这是干嘛用的