選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. [![npm](https://img.shields.io/npm/v/merge-class-names.svg)](https://www.npmjs.com/package/merge-class-names) ![downloads](https://img.shields.io/npm/dt/merge-class-names.svg) ![build](https://img.shields.io/travis/wojtekmaj/merge-class-names/master.svg) ![dependencies](https://img.shields.io/david/wojtekmaj/merge-class-names.svg) ![dev dependencies](https://img.shields.io/david/dev/wojtekmaj/merge-class-names.svg) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)
  2. # Merge-Class-Names
  3. A function that merges given class names, no matter their format. Filters out invalid class names as well.
  4. ## tl;dr
  5. * Install by executing `npm install merge-class-names` or `yarn add merge-class-names`.
  6. * Import by adding `import mergeClassNames from 'merge-class-names'`.
  7. * Pass arguments to it. Forget.
  8. ## Accepted formats
  9. * Strings with one or multiple class names: `a`, `a b`
  10. * Array of strings with one or multiple class names: `['a', 'b']`, `['a b', 'c d']`.
  11. ## Examples
  12. ```js
  13. > mergeClassNames('a', 'b', 'c');
  14. < 'a b c'
  15. > mergeClassNames('a b', 'c d', 'e f');
  16. < 'a b c d e f'
  17. > mergeClassNames(['a', 'b'], ['c', 'd']);
  18. < 'a b c d'
  19. > mergeClassNames(['a b', 'c d'], ['e f', 'g h']);
  20. < 'a b c d e f g h'
  21. > mergeClassNames('a', 'b', falsyCondition && 'c');
  22. < 'a b'
  23. > mergeClassNames('a', 'b', 'c', null, ['d', null], () => {}, 'e', undefined);
  24. < 'a b c d e'
  25. ```
  26. ## License
  27. The MIT License.
  28. ## Author
  29. <table>
  30. <tr>
  31. <td>
  32. <img src="https://github.com/wojtekmaj.png?s=100" width="100">
  33. </td>
  34. <td>
  35. Wojciech Maj<br />
  36. <a href="mailto:kontakt@wojtekmaj.pl">kontakt@wojtekmaj.pl</a><br />
  37. <a href="http://wojtekmaj.pl">http://wojtekmaj.pl</a>
  38. </td>
  39. </tr>
  40. </table>