# corleone

> DOM utilities

Latest version **1.1.3** (published 2019-06-07) · Apache license · 0 weekly downloads

## Install

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

## 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.3 |
| Published | 2019-06-07 |
| First published | 2018-02-16 |
| Weekly downloads | 0 |
| License | Apache |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 67.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Caio Gondim |
| Maintainers | caiogondim |

## Links

- npm: https://www.npmjs.com/package/corleone
- Repository: https://github.com/caiogondim/corleone.js
- Homepage: https://github.com/caiogondim/corleone.js#readme
- Issues: https://github.com/caiogondim/corleone.js/issues
- npm.io page: https://npm.io/package/corleone

## Dependencies (1)

- [fast-memoize](https://npm.io/package/fast-memoize.md) ^2.2.8

## Recent versions

- 1.1.3 (latest) — 2019-06-07
- 1.1.2 — 2018-03-15
- 1.1.1 — 2018-02-16
- 1.1.0 — 2018-02-16
- 1.0.3 — 2018-02-16
- 1.0.2 — 2018-02-16
- 1.0.1 — 2018-02-16

## README

<img src="https://rawgit.com/caiogondim/corleone.js/master/logo/logo.svg" width="100%" />

# corleone

<div>
<img src="http://travis-ci.org/caiogondim/corleone.js.svg?branch=master" alt="Travis CI" />
<img src="http://img.badgesize.io/caiogondim/corleone.js/master/build/corleone.umd.js?compression=gzip" />
</div>

Small DOM utilities.

## Installation

```
npm install corleone -S
```

### Usage

```js
import dom from 'corleone'

dom.show(dom.query('.container'))

```

## API

### `show`

Shows a given DOM node.

```js
dom.show(dom.query('.container'))
```

### `hide`

Hides a given DOM node.

```js
dom.hide(dom.query('.container'))
```

### `create`
Create a DOM node from a string.

```js
const node = dom.create('<div class="container"></div>')
```

### `remove`
Removes a given DOM node from the DOM tree.

```js
dom.remove(dom.query('.container'))
```

### `query`

Alias for `document.querySelector`. If `rootEl` is passed,
`rootEl.querySelector` is used.

```js
const containerNode = dom.query('.container', [rootEl])
```

### `queryAll`

Alias for `document.querySelectorAll`. If `rootEl` is passed,
`rootEl.querySelectorAll` is used.

```js
const imgNodes = dom.queryAll('img', [rootEl])
```

### `offset`

Returns coordinates of element relative to document.

```js
const coords = dom.offset(el)
```

### `closest`

Returns closest parent that matches selector.

```js
const el = dom.closest(el, '.foo')
```

### `matches`

Work as an alias for `Element.prototype.matches`.

```js
const doesMatch = dom.matches(el, '.red')
```

---

[caiogondim.com](https://caiogondim.com) &nbsp;&middot;&nbsp;
GitHub [@caiogondim](https://github.com/caiogondim) &nbsp;&middot;&nbsp;
Twitter [@caio_gondim](https://twitter.com/caio_gondim)

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