{"name":"clsx","version":"1.2.1","repository":{"type":"git","url":"git+https://github.com/lukeed/clsx.git"},"description":"A tiny (228B) utility for constructing className strings conditionally.","module":"dist/clsx.m.js","unpkg":"dist/clsx.min.js","main":"dist/clsx.js","types":"clsx.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=6"},"scripts":{"build":"node bin","test":"uvu -r esm test"},"keywords":["classes","classname","classnames"],"devDependencies":{"esm":"3.2.25","terser":"4.8.0","uvu":"0.5.4"},"gitHead":"6da37d67472ea9eb177a4ea9a9fa2f3f4a3c445e","bugs":{"url":"https://github.com/lukeed/clsx/issues"},"homepage":"https://github.com/lukeed/clsx#readme","_id":"clsx@1.2.1","_nodeVersion":"18.3.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==","shasum":"0ddc4a20a549b59c93a4116bb26f5294ca17dc12","tarball":"http://registry-npm.ywwl.com/clsx/download/clsx-1.2.1.tgz","fileCount":7,"unpackedSize":5671,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDlDp6lqwQYOduGjMvT1fN3znp2gblMG8UQ4SSM587v3AIgPut0xxbSB6y+PXXtFCWqiukZkNzJW5Lf5QcW0o1Oix4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJixNIWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqXIg//UeLsm6RgWPQBzrQZatF/wqKx/X7fcA/7Dg3e45UHpRmMfI6D\r\nxXc6JVjd8WR0CWYCXDmJ7KL0V55PdZoRZfX4WgFifeJuWJwVYiF8Qc5JUdOP\r\n2KRmX6lfKDeqxLeBTnXq7efKWe0ocHLb0RtiUmHAMor174JE4RDss24lIJkM\r\nl52bUH+chuN/CgJZ8sTfKdYLeyvKS+7WkyJtfWeuJP5DC6dhI/ISpFzKHvdr\r\nP1ixx9KyPxCri9uT+xu12nTK3kF5tJuYWhXhjgCQ0nn90phncSzlYlC451f3\r\nr3JuAGEmGKw2VFZz7caPza/H9sHnMOuFnq/P1/PbAaTeTHiaUhuiEsauqFTq\r\nV1v05TRIg5s4xOWAeuoyE6TDvZ6AVfzyDfXyY40G4y+fFKZqIvmQzqXcCSA0\r\nmoC4WxyPrvBvuhQhMJV1q59dtaJiTbfJrnko/Kk+GIJL76VnsP3rWFEaX9tS\r\nKUpjNOBYtnCkkEWqVOoUioEd+yft4wD+mYv+9TNtYLgcoy7kDbKjErsRRyzS\r\nYNR8q1RFmvEQ8ZkuO3ySYafT8JgfffA5uht/ZOvHq3Rs7hq9F+QdIXGzxpRR\r\nYu/TGzl3lgKFSDxPdWseyCaugSsy23fOyw9Kvq0JpfRhaoMZ5aoqUEBDSnra\r\noRkoGH9xmVNIP7yoJfYOnkyYmPX3yHn5EE4=\r\n=KZcy\r\n-----END PGP SIGNATURE-----\r\n","size":2880,"noattachment":false,"key":"/clsx/-/clsx-1.2.1.tgz"},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/clsx_1.2.1_1657066006266_0.21110480925656994"},"_hasShrinkwrap":false,"readme":"# clsx [![CI](https://github.com/lukeed/clsx/workflows/CI/badge.svg)](https://github.com/lukeed/clsx/actions?query=workflow%3ACI) [![codecov](https://badgen.net/codecov/c/github/lukeed/clsx)](https://codecov.io/gh/lukeed/clsx) [![licenses](https://licenses.dev/b/npm/clsx)](https://licenses.dev/npm/clsx)\n\n> A tiny (239B) utility for constructing `className` strings conditionally.<Br>Also serves as a [faster](bench) & smaller drop-in replacement for the `classnames` module.\n\nThis module is available in three formats:\n\n* **ES Module**: `dist/clsx.mjs`\n* **CommonJS**: `dist/clsx.js`\n* **UMD**: `dist/clsx.min.js`\n\n\n## Install\n\n```\n$ npm install --save clsx\n```\n\n\n## Usage\n\n```js\nimport clsx from 'clsx';\n// or\nimport { clsx } from 'clsx';\n\n// Strings (variadic)\nclsx('foo', true && 'bar', 'baz');\n//=> 'foo bar baz'\n\n// Objects\nclsx({ foo:true, bar:false, baz:isTrue() });\n//=> 'foo baz'\n\n// Objects (variadic)\nclsx({ foo:true }, { bar:false }, null, { '--foobar':'hello' });\n//=> 'foo --foobar'\n\n// Arrays\nclsx(['foo', 0, false, 'bar']);\n//=> 'foo bar'\n\n// Arrays (variadic)\nclsx(['foo'], ['', 0, false, 'bar'], [['baz', [['hello'], 'there']]]);\n//=> 'foo bar baz hello there'\n\n// Kitchen sink (with nesting)\nclsx('foo', [1 && 'bar', { baz:false, bat:null }, ['hello', ['world']]], 'cya');\n//=> 'foo bar hello world cya'\n```\n\n\n## API\n\n### clsx(...input)\nReturns: `String`\n\n#### input\nType: `Mixed`\n\nThe `clsx` function can take ***any*** number of arguments, each of which can be an Object, Array, Boolean, or String.\n\n> **Important:** _Any_ falsey values are discarded!<br>Standalone Boolean values are discarded as well.\n\n```js\nclsx(true, false, '', null, undefined, 0, NaN);\n//=> ''\n```\n\n## Modes\n\nThere are multiple \"versions\" of `clsx` available, which allows you to bring only the functionality you need!\n\n#### `clsx`\n> **Size (gzip):** 239 bytes<br>\n> **Availability:** CommonJS, ES Module, UMD\n\nThe default `clsx` module; see [API](#API) for info.\n\n```js\nimport { clsx } from 'clsx';\n// or\nimport clsx from 'clsx';\n```\n\n#### `clsx/lite`\n> **Size (gzip):** 140 bytes<br>\n> **Availability:** CommonJS, ES Module<br>\n> **CAUTION:** Accepts **ONLY** string arguments!\n\nIdeal for applications that ***only*** use the string-builder pattern.\n\nAny non-string arguments are ignored!\n\n```js\nimport { clsx } from 'clsx/lite';\n// or\nimport clsx from 'clsx/lite';\n\n// string\nclsx('hello', true && 'foo', false && 'bar');\n// => \"hello foo\"\n\n// NOTE: Any non-string input(s) ignored\nclsx({ foo: true });\n//=> \"\"\n```\n\n## Benchmarks\n\nFor snapshots of cross-browser results, check out the [`bench`](bench) directory~!\n\n## Support\n\nAll versions of Node.js are supported.\n\nAll browsers that support [`Array.isArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray#Browser_compatibility) are supported (IE9+).\n\n>**Note:** For IE8 support and older, please install `clsx@1.0.x` and beware of [#17](https://github.com/lukeed/clsx/issues/17).\n\n## Tailwind Support\n\nHere some additional (optional) steps to enable classes autocompletion using `clsx` with Tailwind CSS.\n\n<details>\n<summary>\n  Visual Studio Code\n</summary>\n\n1. [Install the \"Tailwind CSS IntelliSense\" Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)\n\n2. Add the following to your [`settings.json`](https://code.visualstudio.com/docs/getstarted/settings):\n\n  ```json\n   {\n    \"tailwindCSS.experimental.classRegex\": [\n      [\"clsx\\\\(([^)]*)\\\\)\", \"(?:'|\\\"|`)([^']*)(?:'|\\\"|`)\"]\n    ]\n   }\n  ```\n</details>\n\nYou may find the [`clsx/lite`](#clsxlite) module useful within Tailwind contexts. This is especially true if/when your application **only** composes classes in this pattern:\n\n```js\nclsx('text-base', props.active && 'text-primary', props.className);\n```\n\n## Related\n\n- [obj-str](https://github.com/lukeed/obj-str) - A smaller (96B) and similiar utility that only works with Objects.\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","publish_time":1657066006535,"_cnpm_publish_time":1657066006535,"dist-tags":{"latest":"2.1.1","next":"2.0.0-next.0"}}