Last active
October 29, 2018 21:55
-
-
Save MeetMartin/db0748253a09d826d0c2d2258c687c99 to your computer and use it in GitHub Desktop.
conditional expression view manager
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'; | |
/** | |
* Sets active view based on current url | |
* @param {String} url url to be checked | |
* @return {String} getActiveView :: String -> String | |
*/ | |
const getActiveView = url => | |
match(url) | |
.includes('rapidView') | |
.thenMatch(url) | |
.includes('view=planning').then('Backlog') | |
.includes('view=reporting').then('Reports') | |
.else('Active Sprints') | |
.includes('browse').then('Open Issue') | |
.includes('projects').then('Projects') | |
.else('Unknown'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment