Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

escodegen

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

escodegen

ECMAScript code generator

  • 1.0.11
  • PyPI
  • Socket score

Maintainers
1

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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc