Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Escodegen (escodegen) is an ECMAScript (also popularly known as JavaScript) code generator from Mozilla's Parser API AST. See the online generator for a demo. This repository contains the Python translation of Escodegen.

Install

pip install escodegen

Usage

Example:

import escodegen

escodegen.generate({
    'type': 'BinaryExpression',
    'operator': '+',
    'left': { 'type': 'Literal', 'value': 20 },
    'right': { 'type': 'Literal', 'value': 2 }
})

produces the string: '20 + 2'

Example:

import escodegen
import esprima

escodegen.generate(esprima.parse('let a=10;let b=20'))

produces the string: 'let a = 10;\nlet b = 20;'

See the API page for options.

About

js

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages