Created
November 10, 2020 08:31
-
-
Save joduplessis/c9244c9427b5fad484a96171df5eef4e to your computer and use it in GitHub Desktop.
Replacing the classNames library with 9 lines.
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 classNames = (object) => { | |
const classArray = []; | |
for (let property in object) { | |
if (object[property]) classArray.push(property) | |
} | |
return classArray.join(' ') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment