Created
September 7, 2016 16:30
-
-
Save leongaban/1455297c47915fa3d57a8a1ea27c0e58 to your computer and use it in GitHub Desktop.
Get name of key that is true
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
let tabs = { | |
twitter: true, | |
news: false, | |
blogs: false, | |
finNews: false | |
} | |
const isTrue = R.equals(true); | |
const getActive = R.filter(isTrue); | |
const activeTab = R.compose(R.head, R.keys, getActive) | |
console.log(activeTab(tabs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment