CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-lodash-kebabcase

The lodash method kebabCase exported as a standalone Node.js module for converting strings to kebab-case format

Overall
score

68%

Evaluation68%

1.08x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-2/

Array Transformation Toolkit

Design a small module that offers concise helpers for reshaping and comparing arrays in common data-processing flows. None of the helpers should mutate their input arrays.

Capabilities

Split input into batches

  • Given [1, 2, 3, 4, 5] and a batch size of 2, return [[1, 2], [3, 4], [5]], keeping item order intact. @test

Remove duplicates while preserving order

  • Given ["a", "a", "b", "c", "b"], return ["a", "b", "c"], keeping the first appearance of each value. @test

Summarize differences between two lists

  • Given current = [1, 2, 3, 5] and incoming = [2, 3, 4], return { added: [4], removed: [1, 5] }, listing new values in the order they appear in incoming and missing values in the order they appeared in current. @test

Flatten nested arrays to a limited depth

  • Given nested = [1, [2, [3, 4]], 5], returning depth 1 yields [1, 2, [3, 4], 5], and depth 2 yields [1, 2, 3, 4, 5]; depth is a non-negative integer. @test

Implementation

@generates

API

/**
 * Splits the provided list into consecutive batches of the given positive size.
 * @param {Array<unknown>} items
 * @param {number} batchSize - A positive integer greater than zero.
 * @returns {Array<Array<unknown>>}
 */
export function createBatches(items, batchSize);

/**
 * Returns a new array with only the first occurrence of each value preserved in order.
 * @param {Array<unknown>} items
 * @returns {Array<unknown>}
 */
export function uniqueOrdered(items);

/**
 * Builds a summary of which values are new and which are missing when comparing two lists.
 * @param {Array<unknown>} current
 * @param {Array<unknown>} incoming
 * @returns {{ added: Array<unknown>, removed: Array<unknown> }}
 */
export function diffSummary(current, incoming);

/**
 * Flattens nested arrays up to the provided depth.
 * @param {Array<any>} nested
 * @param {number} depth - A non-negative integer depth; 0 returns a shallow copy.
 * @returns {Array<any>}
 */
export function flattenToDepth(nested, depth);

Dependencies { .dependencies }

lodash { .dependency }

Provides array transformation utilities.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-lodash-kebabcase

tile.json