Skip to content

Instantly share code, notes, and snippets.

@leongaban
Created September 7, 2016 16:30
Show Gist options
  • Save leongaban/1455297c47915fa3d57a8a1ea27c0e58 to your computer and use it in GitHub Desktop.
Save leongaban/1455297c47915fa3d57a8a1ea27c0e58 to your computer and use it in GitHub Desktop.
Get name of key that is true
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