Created
May 3, 2018 20:06
-
-
Save ramonvictor/c37efa0a15452ee3b86818c1686836c4 to your computer and use it in GitHub Desktop.
Computed CSS class list in Svelte
This file contains 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 getClassListFromObject = (config) => { | |
if (typeof config !== 'object') { | |
throw new Error('getClassListFromObject: expects an object'); | |
} | |
return Object.keys(config).filter(className => config[className]).join(' '); | |
}; | |
export default getClassListFromObject; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment