# ast-pretty-print

> A pretty printer for AST-like structures

Latest version **2.0.1** (published 2017-09-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install ast-pretty-print
pnpm add ast-pretty-print
yarn add ast-pretty-print
bun add ast-pretty-print
```

## 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 | 2.0.1 |
| Published | 2017-09-08 |
| First published | 2017-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | James Kyle |
| Maintainers | thejameskyle |

## Links

- npm: https://www.npmjs.com/package/ast-pretty-print
- npm.io page: https://npm.io/package/ast-pretty-print

## Dependencies (2)

- [pretty-format2](https://npm.io/package/pretty-format2.md) ^2.0.3
- [pretty-format-ast](https://npm.io/package/pretty-format-ast.md) ^1.0.1

## Recent versions

- 2.0.1 (latest) — 2017-09-08
- 2.0.0 — 2017-06-08
- 1.3.0 — 2017-06-02
- 1.2.1 — 2017-05-29
- 1.2.0 — 2017-05-27
- 1.1.5 — 2017-05-16
- 1.1.4 — 2017-05-15
- 1.1.3 — 2017-05-15
- 1.1.2 — 2017-05-15
- 1.1.1 — 2017-05-15
- 1.1.0 — 2017-05-15
- 1.0.0 — 2017-05-15

## README

# ast-pretty-print

> A pretty printer for AST-like structures

- Super fast (useful for build tools)
- Concise output (useful for debugging)
- Consistent output (useful for snapshot testing)

```js
import parser from 'parser';
import printAST from 'ast-pretty-print';

let code = `...`;
let ast = parser.parse(code);
let printed = printAST(ast);

console.log(printed);
```

```js
Node "FunctionDeclaration"
  __clone: [Function __clone]
  async: false
  body: Node "BlockStatement" (1:29, 1:31)
    body: Array []
    directives: Array []
  expression: false
  generator: false
  id: Node "Identifier" (1:9, 1:10)
    name: "a"
  params: Array [
    Node "Identifier" (1:11, 1:18)
      name: "b"
      typeAnnotation: Node "TypeAnnotation" (1:12, 1:18)
          typeAnnotation: Node "StringLiteralTypeAnnotation" (1:14, 1:18)
              extra: Object {
                  "raw": "\"hi\"",
                  "rawValue": "hi",
                }
             value: "hi",
    Node "Identifier" (1:20, 1:21)
      name: "c",
    Node "RestElement" (1:23, 1:27)
      argument: Node "Identifier" (1:26, 1:27)
        name: "d",
  ]
```

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