CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-escodegen

ECMAScript code generator that transforms Mozilla's Parser API ASTs back into executable JavaScript code

95

1.07x
Overview
Eval results
Files

task.mdevals/scenario-6/

Modern JavaScript AST Transpiler

A utility that converts JavaScript Abstract Syntax Tree (AST) nodes representing modern ECMAScript features into executable JavaScript source code.

Capabilities

Generate Arrow Functions

  • Given an AST node representing an arrow function (x, y) => x + y, generate the correct JavaScript code string. @test

Generate Async/Await

  • Given an AST node representing an async function with await expressions, generate the correct JavaScript code string. @test

Generate Optional Chaining

  • Given an AST node representing optional chaining obj?.property?.method?.(), generate the correct JavaScript code string. @test

Generate Class Syntax

  • Given an AST node representing a class with constructor and methods, generate the correct JavaScript code string. @test

Implementation

@generates

API

/**
 * Generates JavaScript code from an Abstract Syntax Tree node.
 *
 * @param {Object} astNode - The AST node conforming to Mozilla's Parser API.
 * @returns {string} The generated JavaScript code as a string.
 */
function generate(astNode) {
  // IMPLEMENTATION HERE
}

module.exports = {
  generate
};

Dependencies { .dependencies }

escodegen { .dependency }

Provides AST-to-code generation capabilities with comprehensive JavaScript syntax support.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-escodegen

tile.json