# ast-plugin

> The simplest abstract syntax tree walker.

Latest version **0.0.7** (published 2018-12-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install ast-plugin
pnpm add ast-plugin
yarn add ast-plugin
bun add ast-plugin
```

## 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.0.7 |
| Published | 2018-12-30 |
| First published | 2018-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | hustcc |
| Maintainers | atool |
| Keywords | ast, plugin, ast-plugin |

## Links

- npm: https://www.npmjs.com/package/ast-plugin
- Repository: https://github.com/hustcc/ast-plugin
- Homepage: https://github.com/hustcc/ast-plugin#readme
- Issues: https://github.com/hustcc/ast-plugin/issues
- npm.io page: https://npm.io/package/ast-plugin

## 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

- 0.0.7 (latest) — 2018-12-30
- 0.0.6 — 2018-12-30
- 0.0.5 — 2018-12-17
- 0.0.4 — 2018-12-15
- 0.0.3 — 2018-12-15
- 0.0.2 — 2018-11-15
- 0.0.1 — 2018-11-12
- 0.0.1-beta.1 — 2018-11-12

## README

# ast-plugin

> The simplest abstract syntax tree walker.


## Install

> npm i --save ast-plugin



## Usage

 - Traverse Ast plugins

```js
import { Ast, Plugin } from 'ast-plugin';

new Ast(ast).traverse([
  new TestPlugin(cfg),
  // ...
]);
```

 - Write an ast plugin

```js
import { Ast, Plugin } from 'ast-plugin';

class TestPlugin extends Plugin {

  pre = () => {};

  visitor = () => {
    return {
      // process node with type = 'text'
      text: ast => {
        console.log(ast.node);
        ast.segment();
      },
    };
  };

  post = () => {};
}
```



## Used by

 - [lint-md](https://github.com/hustcc/lint-md): Cli tool to lint your markdown file for Chinese.




## License

MIT@[hustcc](https://github.com/hustcc).

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