# classname

> Easy configuration of class names

Latest version **0.0.0** (published 2015-04-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install classname
pnpm add classname
yarn add classname
bun add classname
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2015-04-06 |
| First published | 2015-04-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Gorm Casper |
| Maintainers | casperin |
| Keywords | classname |

## Links

- npm: https://www.npmjs.com/package/classname
- Repository: https://github.com/casperin/classname
- Issues: https://github.com/casperin/classname/issues
- npm.io page: https://npm.io/package/classname

## Recent versions

- 0.0.0 (latest) — 2015-04-06

## README

# classname v.0.0.1

Simple tool to build (and apply) classes. This is very much inspired by Jed Watson's [classnames](https://github.com/JedWatson/classnames), but with added functionality and slight differences in interface.

## Install

Npm: `npm install classname`

Or just load `classname.js` in your browser, and call it directly.

## Documentation

```javascript
classname(1, 'one', false, 'two'); // '1 one two'

classname({
    one: true,
    two: false,
    three: true
});
// 'one three'

classname(['one', 'two'], {one: false, three: true});
// 'two three'
```

Objects always overwrite other types of parameters

```javascript
classname({one: false}, ['one', 'two']);
// 'two'
```

`classname` handles more than string, numbers, arrays, and objects though. You can give it elements, nodelists, or jQuery elements too.

```javascript
classname(document.querySelectorAll('.foo'), 'bar');
// 'foo bar' (assuming that the found elements do not have other class names as well)
```

`classname` can also set the class to the element for you. Use `.setTo()`:

```javascript
var el = document.getElementById('foo');

classname.setTo(el)('one', 'two');

el.className; // 'one two'
```

---
_Source: https://npm.io/package/classname · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
