or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-4/

CSV Row Formatter

A utility for formatting array data into CSV-formatted strings with various customization options.

Capabilities

Formats arrays into CSV strings

  • Given an array ['apple', 'banana', 'cherry'], it returns 'apple,banana,cherry' @test
  • Given an array ['red', 'green', 'blue'] with semicolon separator, it returns 'red;green;blue' @test
  • Given an array ['item1', 'item2', 'item3'] with pipe separator, it returns 'item1|item2|item3' @test

Handles edge cases

  • Given an empty array [], it returns an empty string '' @test
  • Given an array with one element ['single'], it returns 'single' @test

Implementation

@generates

API

/**
 * Formats an array into a CSV-formatted string.
 *
 * @param {Array} items - The array of items to format.
 * @param {string} [separator=','] - The separator to use between elements. Defaults to comma.
 * @returns {string} The formatted CSV string.
 */
function formatCsv(items, separator = ',') {
  // IMPLEMENTATION HERE
}

module.exports = {
  formatCsv,
};

Dependencies { .dependencies }

lodash { .dependency }

Provides utility functions for array manipulation.