or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-1/

Promise Settlement Tracker with Validation

A utility that tracks the settlement status of multiple asynchronous operations with robust input validation and error handling.

Capabilities

Input Validation

  • The tracker validates that it receives an iterable as input and throws a TypeError for non-iterable inputs (e.g., numbers or null) @test
  • When used as a method, it validates that the context is a valid object and throws a TypeError for invalid contexts @test

Settlement Tracking

  • The tracker accepts an array of promises and returns an array of result objects, each with a status property indicating whether the promise fulfilled or rejected @test
  • The tracker handles a mix of promises and non-promise values, treating non-promise values as immediately fulfilled @test

Implementation

@generates

API

/**
 * Tracks settlement of multiple asynchronous operations.
 *
 * @param {Iterable} iterable - An iterable of promises and/or values to track
 * @returns {Promise<Array>} A promise that resolves with an array of result objects
 * @throws {TypeError} Throws if iterable is not iterable or if called with invalid context
 */
function trackSettlements(iterable) {
  // IMPLEMENTATION HERE
}

module.exports = { trackSettlements };

Dependencies { .dependencies }

promise.allsettled { .dependency }

Provides promise settlement tracking with robust validation