Created
January 21, 2017 15:48
-
-
Save electerious/99d08574044a68b1794e1e69274fccc5 to your computer and use it in GitHub Desktop.
Conditionally convert the keys of an object to a string of class names
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
const toClassString = (obj) => Object.keys(obj).filter((key) => obj[key]===true).join(' ').trim() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: