CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-coffeescript

A programming language that compiles into JavaScript, offering more concise and readable syntax while maintaining full JavaScript compatibility.

77

1.01x
Overview
Eval results
Files

task.mdevals/scenario-10/

CoffeeScript Destructuring Utilities

Build a utility module that compiles and evaluates CoffeeScript code featuring complex destructuring patterns. The module should provide functions that demonstrate and test CoffeeScript's destructuring capabilities, including nested structures, default values, rest operators, and object property aliasing.

Capabilities

Compile nested array destructuring

  • Compiles CoffeeScript code with nested array destructuring [a, [b, c]] = [1, [2, 3]] and returns valid JavaScript @test
  • Compiles CoffeeScript with array elision (skipping elements) [a, , c] = [1, 2, 3] and returns valid JavaScript @test

Compile object destructuring with aliasing

  • Compiles CoffeeScript with object property aliasing {old: new} = {old: 'value'} and returns valid JavaScript @test
  • Compiles CoffeeScript with nested object destructuring {a: {b: c}} = {a: {b: 5}} and returns valid JavaScript @test

Compile destructuring with defaults

  • Compiles CoffeeScript with default values in array destructuring [a = 10, b = 20] = [1] and returns valid JavaScript @test
  • Compiles CoffeeScript with default values in object destructuring {x = 5, y = 10} = {x: 3} and returns valid JavaScript @test

Compile destructuring with rest operator

  • Compiles CoffeeScript with rest operator in arrays [first, rest...] = [1, 2, 3, 4] and returns valid JavaScript @test
  • Compiles CoffeeScript with mixed patterns (objects in arrays) [{name}, {age}] = [{name: 'Alice'}, {age: 30}] and returns valid JavaScript @test

Implementation

@generates

API

/**
 * Compiles CoffeeScript code to JavaScript
 * @param {string} coffeeCode - The CoffeeScript code to compile
 * @returns {string} The compiled JavaScript code
 */
function compileDestructuring(coffeeCode) {
  // Implementation
}

/**
 * Compiles and evaluates CoffeeScript code with destructuring
 * @param {string} coffeeCode - The CoffeeScript code to compile and evaluate
 * @returns {any} The result of evaluating the code
 */
function evalDestructuring(coffeeCode) {
  // Implementation
}

module.exports = {
  compileDestructuring,
  evalDestructuring
};

Dependencies { .dependencies }

CoffeeScript { .dependency }

Provides CoffeeScript compilation and evaluation support, particularly for complex destructuring patterns.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-coffeescript

tile.json