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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
|