Skip to content

Instantly share code, notes, and snippets.

@joduplessis
Created November 10, 2020 08:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joduplessis/c9244c9427b5fad484a96171df5eef4e to your computer and use it in GitHub Desktop.
Save joduplessis/c9244c9427b5fad484a96171df5eef4e to your computer and use it in GitHub Desktop.
Replacing the classNames library with 9 lines.
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