or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-9/

Data Pipeline Processor

Build a data pipeline processor that transforms and filters collections of data using iterator-based patterns.

Requirements

Your task is to implement a data processor that:

  1. Accepts an array of user records (objects with id, name, age, and score properties)
  2. Provides a method to create a processing pipeline that:
    • Filters records based on a minimum age threshold
    • Maps each record to extract only specific fields
    • Sorts the results by a specified field
  3. Returns results that can be consumed using JavaScript iterator protocols (for...of loops, spread operator, etc.)

Expected Behavior

Pipeline Creation

  • It creates a pipeline that filters users by minimum age @test
  • It maps records to extract specified fields @test
  • It sorts results by a given field @test

Iterator Support

  • The pipeline result can be iterated using for...of loops @test
  • The pipeline result can be spread into an array @test
  • The pipeline result can be consumed by Array.from() @test

Implementation

@generates

API

/**
 * Creates a data pipeline processor
 *
 * @param {Array} data - Array of user records
 * @returns {Object} Pipeline builder with chainable methods
 */
function createPipeline(data) {
  // IMPLEMENTATION HERE
}

/**
 * Example usage:
 * const pipeline = createPipeline(users)
 *   .filterByAge(18)
 *   .selectFields(['id', 'name'])
 *   .sortBy('name');
 *
 * // Can be used with for...of
 * for (const user of pipeline) {
 *   console.log(user);
 * }
 *
 * // Can be spread
 * const results = [...pipeline];
 */

module.exports = { createPipeline };

Dependencies { .dependencies }

lodash { .dependency }

Provides utility functions for data manipulation and chaining support.