Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
Last active October 29, 2018 21:55
Show Gist options
  • Save MeetMartin/db0748253a09d826d0c2d2258c687c99 to your computer and use it in GitHub Desktop.
Save MeetMartin/db0748253a09d826d0c2d2258c687c99 to your computer and use it in GitHub Desktop.
conditional expression view manager
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