CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-coffeescript

tessl install tessl/npm-coffeescript@2.7.0

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

Agent Success

Agent success rate when using this tile

77%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.01x

Baseline

Agent success rate without this tile

76%

task.mdevals/scenario-1/

Task Manager Class

Build a task management system that organizes and filters tasks efficiently.

Requirements

Implement a TaskManager class that:

  1. Stores a collection of tasks, where each task has:

    • A title (string)
    • A priority (number: 1=low, 2=medium, 3=high)
    • A status (string: "pending", "in-progress", or "completed")
    • A due date (Date object)
  2. Provides methods to:

    • Add a task to the collection
    • Get all tasks with a specific status
    • Get all high-priority tasks (priority === 3)
    • Get tasks due within the next N days
    • Mark a task as completed by title
  3. The class should:

    • Automatically bind all methods so they can be called with any context
    • Use a parent BaseManager class that provides a log method for tracking operations
    • Use efficient filtering with guard conditions

Implementation

@generates

API

class BaseManager
  log: (message) ->
    console.log "[#{new Date().toISOString()}] #{message}"

class TaskManager extends BaseManager
  constructor: () ->

  addTask: (title, priority, status, dueDate) =>

  getTasksByStatus: (status) =>

  getHighPriorityTasks: () =>

  getTasksDueSoon: (days) =>

  completeTask: (title) =>

module.exports = { TaskManager, BaseManager }

Test Cases

  • Creating a TaskManager and adding a task with title "Write tests", priority 3, status "pending", due date 2 days from now stores the task correctly @test

  • Calling getTasksByStatus("pending") returns only tasks with "pending" status @test

  • Calling getHighPriorityTasks() returns only tasks where priority equals 3 @test

  • Calling getTasksDueSoon(7) returns tasks with due dates within the next 7 days from today @test

  • Calling completeTask("Write tests") changes that task's status to "completed" @test

  • Methods remain bound when extracted from the instance and called separately @test

  • The log method from BaseManager is accessible via super and logs operations @test

Dependencies { .dependencies }

coffeescript { .dependency }

Provides the CoffeeScript compiler for writing code with advanced language features including bound methods, super calls, and comprehensions.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/coffeescript@2.7.x
tile.json