ECMAScript code generator
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file escodegen-1.0.11-py3-none-any.whl
.
File metadata
- Download URL: escodegen-1.0.11-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e46fbbef86faf175165c8ebaa2207b1ee5624918ee9e1daf67fa247d2dbb074 |
|
MD5 | 2f557db558d6eb38647c0b145a48cca3 |
|
BLAKE2b-256 | bf339d9637765f4f024740185e5ebaae28acdaa9d54b831d3bb6a11a82834447 |