# vtree-query

> ### Install

Latest version **0.2.0** (published 2015-05-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install vtree-query
pnpm add vtree-query
yarn add vtree-query
bun add vtree-query
```

## 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.2.0 |
| Published | 2015-05-18 |
| First published | 2015-05-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Zolmeister |
| Maintainers | zolmeister |

## Links

- npm: https://www.npmjs.com/package/vtree-query
- Repository: https://github.com/Zorium/vtree-query
- Issues: https://github.com/Zorium/vtree-query/issues
- npm.io page: https://npm.io/package/vtree-query

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) ^3.8.0
- [cssauron](https://npm.io/package/cssauron.md) ^1.2.0
- [gulp-mocha](https://npm.io/package/gulp-mocha.md) ^2.0.1
- [coffee-script](https://npm.io/package/coffee-script.md) ^1.9.2

## Recent versions

- 0.2.0 (latest) — 2015-05-18
- 0.1.0 — 2015-05-18

## README

# vtree-query

### Install

```bash
npm install --save-dev vtree-query
```

### Example

```coffee
z = require 'zorium'
query = require 'vtree-query'

tree = z 'div', 'test'
$ = query(tree)
$('div').contents.should.be 'test'

tree =
  z 'div',
    z '.class',
      z '#id',
        z 'span',
          'abc'
        z 'span',
          'xyz'

$ = query(tree)
$$ = query.all(tree)

$('div .class #id span').contents.should.be 'abc'
$('span').contents.should.be 'abc'

$$('div .class #id span').length.should.be 2
$$('span').length.should.be 2

# Properties
tree = z 'input', type: 'button'
$ = query tree
$('input').type.should.be 'button'

# Attributes
tree = z 'div',
  z 'a', href: 'abc', 'aaa'

$ = query tree
$('a[href=abc]').contents.should.be 'aaa'
```

## query(vtree, selector)

Returns first matching vNode, with a `contents` property
This method supports [currying](http://en.wikipedia.org/wiki/Currying)  

```coffee
tree = z 'div', 'test'
$ = query(tree)
$('div').contents.should.be 'test'
```

## query.all()

Returns all matching vNodes, with `contents` properties
This method supports [currying](http://en.wikipedia.org/wiki/Currying)  

```coffee
tree = z 'div', 'test'
$$ = query.all(tree)
$$('div')[0].contents.should.be 'test'
```

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