Skip to content
The ESTree Nodes and JavaScript AST to JavaScript Code Generator in Elixir
Elixir
Latest commit 003bcf5 Jun 29, 2016 @bryanjos committed on GitHub Merge pull request #9 from bobjflong/BL/formatting
Fixup and spec for object formatting

README.md

Elixir-ESTree Documentation Downloads

Defines structs that represent the JavaScript AST nodes from the ESTree spec.

ESTree Spec

JSX AST Spec

Also includes a JavaScript AST to JavaScript code generator.

alias ESTree.Tools.Builder
alias ESTree.Tools.Generator

ast = Builder.array_expression([
  Builder.literal(1),
  Builder.identifier(:a)
])

Generator.generate(ast)
# "[1, a]"

#jsx ast and generation
    ast = Builder.jsx_element(
      Builder.jsx_opening_element(
        Builder.jsx_identifier(
          "Test"
        )
      ),
      [],
      Builder.jsx_closing_element(
        Builder.jsx_identifier(
          "Test"
        )
      )
    )

Generator.generate(ast)
# "<Test></Test>"
Something went wrong with that request. Please try again.