classter
v1.0.1
Published
A utility for conditionally joining classNames together. Handles various argument types: string, object, arrays, etc.
Downloads
2
Readme
classter • Documentation
A utility for conditionally joining classNames together. Handles various argument types: string, object, arrays, etc.
Installation
You can install the package using npm, yarn, or pnpm.
pnpm add classter
yarn install classter
npm install classter
Usage
import cls from "classter";
cls("foo", "bar"); // => 'foo bar'
cls("foo", { bar: true }); // => 'foo bar'
cls({ "foo-bar": true }); // => 'foo-bar'
cls({ "foo-bar": false }); // => ''
cls({ foo: true }, { bar: true }); // => 'foo bar'
cls({ foo: true, bar: true }); // => 'foo bar'
// lots of arguments of various types
cls("foo", { bar: true, duck: false }, "baz", { quux: true }); // => 'foo bar baz quux'
// other falsy values are just ignored
cls(null, false, "bar", undefined, 0, 1, { baz: null }, ""); // => 'bar 1'
tsup
Bundle your TypeScript library with no config, powered by esbuild.
https://tsup.egoist.dev/
How to use this
- install dependencies
# pnpm
$ pnpm install
# yarn
$ yarn install
# npm
$ npm install
- Add your code to
src
- Add export statement to
src/index.ts
- Test build command to build
src
. Once the command works properly, you will seedist
folder.
# pnpm
$ pnpm run build
# yarn
$ yarn run build
# npm
$ npm run build
- Publish your package
$ npm publish
test package
https://www.npmjs.com/package/classter