Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/joyqi/cash-selector

A small querySelector and querySelectorAll alternative.
https://github.com/joyqi/cash-selector

Last synced: 17 days ago
JSON representation

A small querySelector and querySelectorAll alternative.

Awesome Lists containing this project

README

        

# cash-selector

Cash Selector is a simple querySelector and querySelectorAll wrapper.
It wraps the native querySelector and querySelectorAll methods to provide a more convenient way to select elements.

## Installation

```bash
npm install cash-selector
```

## Usage

```typescript
import { $, $$ } from 'cash-selector';

const element = $('#my-element');
const elements = $$('.my-elements');
```

You can also specify a generic type to get the correct type of the element.

```typescript
import { $, $$ } from 'cash-selector';

const element = $('#my-element');
const elements = $$('.my-elements');
```

Parent element can be specified as the second argument.

```typescript
import { $, $$ } from 'cash-selector';

const element = $('#my-element', '#parent-element');
const elements = $$('.my-elements', '#parent-element');
```