Skip to content

Latest commit

 

History

History
49 lines (42 loc) · 1.12 KB

README.md

File metadata and controls

49 lines (42 loc) · 1.12 KB

pretty-format-ast

Pretty format plugin to print ASTs prettier

Installation

yarn add pretty-format pretty-format-ast

Usage

const prettyFormat = require('pretty-format');
const prettyFormatAST = require('pretty-format-ast');

prettyFormat(val, {
  plugins: [prettyFormatAST],
})
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",
  ]