# by-el

> Wrapper to type less code to select elements

Latest version **1.0.4** (published 2020-08-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install by-el
pnpm add by-el
yarn add by-el
bun add by-el
```

## 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.0.4 |
| Published | 2020-08-02 |
| First published | 2020-06-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Claudio Acioli |
| Maintainers | claudioacioli |
| Keywords | by, js, selector, elements |

## Links

- npm: https://www.npmjs.com/package/by-el
- npm.io page: https://npm.io/package/by-el

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.4 (latest) — 2020-08-02
- 1.0.3 — 2020-07-04
- 1.0.2 — 2020-06-18
- 1.0.1 — 2020-06-18
- 1.0.0 — 2020-06-18

## README

# by-el

Welcome to super simpliest wrapper library to type less code!

## Install

```bash
npm install by-el
```

## A React sample

```node

import React from 'react';
import ReactDOM from 'react-dom';
import { byId } from 'by-el';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  byId('root')
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();

```

## Some docs

Import wrapper functions:

```node
import {
  byId,
  byClass,
  bySelector,
  byTag,
  byName,
  byAll
} from 'by-el`;
```

to select element by id:

```node
byId("element-id");

// specific parent
byId("element-id", parentElement);
```

to select element by selector:

```node
bySelector("#element-id");
bySelector(".class");
bySelector("tag");

//specific parent
bySelector(".class", byId("element-id"));

```

to select elements by className:

```node
byClass("class");

//specific parent
byClass("class", bySelector("tag"));
```

to select elements by Name:

```node
byName("name");

//specific parent
byName("name", bySelector("tag"));
```

to select elements by TagName:

```node
byTag("tag");

//specific parent
byTag("tag", bySelector("#element-id"));
```

to select elements by all:

```node
byAll(".class");

//specific parent
byAll(".class", byId("element-id"));
```

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