# clus

> A minimalist JavaScript library for modern browsers.

Latest version **1.1.2** (published 2016-09-04) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2016-09-04 |
| First published | 2016-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | JustClear |
| Maintainers | justclear |
| Keywords | clus, library, class, dom |

## Links

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

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2016-09-04
- 1.1.1 — 2016-09-04
- 1.2.0 — 2016-08-26
- 1.1.0 — 2016-07-19
- 1.0.6 — 2016-07-04
- 1.0.5 — 2016-07-04
- 1.0.4 — 2016-07-04
- 1.0.3 — 2016-07-04
- 1.0.2 — 2016-07-04
- 1.0.1 — 2016-07-04
- 1.0.0 — 2016-07-04

## README

# Clus - A minimalist JavaScript library for modern browsers.

[![dependencies](https://david-dm.org/justclear/clus.svg)](https://david-dm.org/justclear/clus#info=dependencies&view=table)
[![devDependencies](https://david-dm.org/justclear/clus/dev-status.svg)](https://david-dm.org/justclear/clus#info=devDependencies&view=table)

## Emoji Commit

Commit Type             | Emoji
----------------------- | -------------
Initial Commit          | :tada: `:tada:`
Structure               | :art: `:art:`
Documentation           | :memo: `:memo:`
New Idea                | :bulb: `:bulb:`
New Feature             | :sparkles: `:sparkles:`
Bug                     | :bug: `:bug:`
Version Tag             | :bookmark: `:bookmark:`
Performance             | :racehorse: `:racehorse:`
Tooling                 | :wrench: `:wrench:`
Tests                   | :rotating_light: `:rotating_light:`
Deprecation             | :poop: `:poop:`
Work In Progress (WIP)  | :construction: `:construction:`
Upgrading               | :arrow_up: `:arrow_up:`

Example:

> ":art: fixing coding standard"

## Usage

### Install

```sh
$ npm i clus --save
# or
$ bower i clus
```

### Instance methods

- <a href="#ready">`.ready()`</a>
- <a href="#add-class">`.addClass()`</a>
- <a href="#remove-class">`.removeClass()`</a>
- <a href="#has-class">`.hasClass()`</a>
- <a href="#toggle-class">`.toggleClass()`</a>
- <a href="#append">`.append()`</a>
- <a href="#append-to">`.appendTo()`</a>
- <a href="#parent">`.parent()`</a>
- <a href="#parents">`.parents()`</a>
- <a href="#each-global">`$.each()`</a>
- <a href="#each-instance">`.each()`</a>
- <a href="#map-global">`$.map()`</a>
- <a href="#map-instance">`.map()`</a>
- <a href="#on">`.on()`</a>
- <a href="#off">`.off()`</a>

### DOM

<a name="ready"></a>
#### `$(document).ready()`

```js
$(document).ready(function () {
    // DOM is ready
});

// or

$(function () {
    // DOM is ready
});
```

<a name="add-class"></a>
#### `.addClass(clasNname)`

Example:

```js
$('.hello').addClass('world');
$('p').addClass('hello world');
// or
$('p').addClass('hello').addClass('world');
```

<a name="remove-class"></a>
#### `.removeClass(clasNname)`

Example:

```js
$('.hello').removeClass('hello').addClass('hi');
$('p').addClass('hello world').removeClass('hello world');
// or
$('p').addClass('hello world').removeClass('hello').removeClass('world');
```

<a name="has-class"></a>
#### `.hasClass(clasNname)`

Example:

```js
$('p').hasClass('hello'); // true
$('p').hasClass('world'); // false
```

<a name="toggle-class"></a>
#### `.toggleClass(clasNname)`

Example:

```js
$('p').toggleClass('hello');
```

<a name="append"></a>
#### `.append(DOMString)`

Example:

```js
$('body').append('<h1>Hello Clus</h1>');
```

<a name="append-to"></a>
#### `.appendTo(selector)`

Example:

```js
$('<h1>Hello Clus</h1>').appendTo('body');
```

<a name="parent"></a>
#### `.parent()`

Example:

```js
$('.hello').parent();
```

<a name="parents"></a>
#### `.parents()`

Example:

```js
$('.hello').parents();
$('.hello').parents('body');
```

<a name="each-global"></a>
#### `$.each()`

Example:

```js
$.each(['just', 'hello', 'world'], function (item, index) {
    console.log(item, index);
});
// just 0
// hello 1
// world 2
```

<a name="each-instance"></a>
#### `.each()`

Example:

```js
$('.hello').each(function (item, index) {
    $(this).addClass('world');
    console.log($(this));
});
```

<a name="map-global"></a>
#### `$.map()`

Example:

```js
$.map(['just', 'hello', 'world'], function (item, index) {
    console.log(item, index);
});
// just 0
// hello 1
// world 2
```

<a name="map-instance"></a>
#### `.map()`

Example:

```js
$('.hello').map(function (item, index) {
    $(this).addClass('world');
    console.log($(this));
});
```

<a name="on"></a>
#### `.on()`

Example:

```js
$('.hello').on('click', function () {
    console.log($(this));
});

$(document).on('click', '.hello', function () {
    console.log($(this));
});
```

<a name="off"></a>
#### `.off()`

Example:

```js
let hello = function () {
    console.log('hello');
}
$(document).on('click', '.hello', hello);
$(document).off('click', '.hello', hello);
```

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