merge-class-names

WebJar for merge-class-names

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

merge-class-names
Last Version

Last Version

1.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

merge-class-names
WebJar for merge-class-names
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/wojtekmaj/merge-class-names

Download merge-class-names

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/merge-class-names/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>merge-class-names</artifactId>
    <version>1.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/merge-class-names/
implementation 'org.webjars.npm:merge-class-names:1.3.0'
// https://jarcasting.com/artifacts/org.webjars.npm/merge-class-names/
implementation ("org.webjars.npm:merge-class-names:1.3.0")
'org.webjars.npm:merge-class-names:jar:1.3.0'
<dependency org="org.webjars.npm" name="merge-class-names" rev="1.3.0">
  <artifact name="merge-class-names" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='merge-class-names', version='1.3.0')
)
libraryDependencies += "org.webjars.npm" % "merge-class-names" % "1.3.0"
[org.webjars.npm/merge-class-names "1.3.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

npm downloads CI dependencies dev dependencies tested with jest

Merge-Class-Names

A function that merges given class names, no matter their format. Filters out invalid class names as well.

tl;dr

  • Install by executing npm install merge-class-names or yarn add merge-class-names.
  • Import by adding import mergeClassNames from 'merge-class-names'.
  • Pass arguments to it. Forget.

Accepted formats

  • Strings with one or multiple class names: a, a b
  • Array of strings with one or multiple class names: ['a', 'b'], ['a b', 'c d'].

Examples

> mergeClassNames('a', 'b', 'c');
< 'a b c'

> mergeClassNames('a b', 'c d', 'e f');
< 'a b c d e f'

> mergeClassNames(['a', 'b'], ['c', 'd']);
< 'a b c d'

> mergeClassNames(['a b', 'c d'], ['e f', 'g h']);
< 'a b c d e f g h'

> mergeClassNames('a', 'b', falsyCondition && 'c');
< 'a b'

> mergeClassNames('a', 'b', 'c', null, ['d', null], () => {}, 'e', undefined);
< 'a b c d e'

License

The MIT License.

Author

Wojciech Maj
[email protected]
http://wojtekmaj.pl

Versions

Version
1.3.0