# parse5-traverse

> simple but flexible parse5 AST traversal with pre and post visitors

Latest version **1.0.3** (published 2018-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install parse5-traverse
pnpm add parse5-traverse
yarn add parse5-traverse
bun add parse5-traverse
```

## 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.3 |
| Published | 2018-07-24 |
| First published | 2018-07-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 0 |
| Unpacked size | 167.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jan Peer Stöcklmair |
| Maintainers | jpeer |
| Keywords | ast, traverse, traversal, walk, visit, visitor, parse5 |

## Links

- npm: https://www.npmjs.com/package/parse5-traverse
- Repository: https://github.com/JPeer264/parse5-traverse
- Homepage: https://github.com/JPeer264/parse5-traverse#readme
- Issues: https://github.com/JPeer264/parse5-traverse/issues
- npm.io page: https://npm.io/package/parse5-traverse

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2018-07-24
- 1.0.2 — 2018-07-09
- 1.0.1 — 2018-07-09
- 1.0.0 — 2018-07-08

## README

# parse5-traverse
[![Build Status](https://travis-ci.org/JPeer264/parse5-traverse.svg?branch=master)](https://travis-ci.org/JPeer264/parse5-traverse)
[![Coverage Status](https://coveralls.io/repos/github/JPeer264/parse5-traverse/badge.svg?branch=master)](https://coveralls.io/github/JPeer264/parse5-traverse?branch=master)

Simple but flexible AST traversal with pre and post visitors. The main code of this project comes from [ast-traverse](https://github.com/olov/ast-traverse/blob/master/ast-traverse.js). As `ast-traverse` is not compatible with [parse5](https://github.com/inikulin/parse5/blob/master/packages/parse5/docs/index.md), `parse5-traverse` got created.

## Getting started

```sh
$ npm install --save parse5-traverse
```

## Usage
```js
const parse5 = require('parse5');
const traverse = require('parse5-traverse');

const documentFragment = parse5.parseFragment('<table></table>');

// print AST node types, pre-order (node first, then its children)
traverse(ast, {
  pre(node, parent) {
    // node -> the current node
    // parent -> the parent node
  }
  post(node, parent) {
  }
});
```

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