Skip to content

Commit

Permalink
docs(jsdoc): add for classNames()
Browse files Browse the repository at this point in the history
  • Loading branch information
sebkolind committed Dec 5, 2023
1 parent 03b9559 commit 410ce6f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/one.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,18 @@ function router(el, routes) {
handler()
}

/**
* A helper method to add classes conditionally.
* @param {string[]} classes
* @example
* ```js
* classNames(
* 'class-1',
* true && 'class-2',
* false && 'class-3',
* )
* ```
*/
function classNames(...classes) {
return classes.filter(Boolean).join(' ')
}
Expand Down

0 comments on commit 410ce6f

Please sign in to comment.