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-1/

Argument Shaping Pipeline

Build a small utility that composes functions while reshaping the arguments they receive. Callers should be able to flip composition order, remap inputs for individual steps, append defaults, and cap how many arguments reach sensitive steps.

Capabilities

Directional composition

  • With steps [add, square, toTag] where add(a, b) sums two numbers, square(n) squares a number, and toTag(n) returns #${n}, composeShaped(steps) runs them left-to-right so pipeline(2, 3) yields "#25" @test
  • When called as composeShaped([toTag, square, add], { direction: "rtl" }), the same three functions run right-to-left so pipeline(2, 3) still produces "#25" because addition happens first even though it is listed last @test

Reorders and extends arguments

  • shapeArgs(formatName, { fromOriginal: [1, 0], append: [" Jr."] }) wraps a formatter so invoking the shaped version with ("Ada", "Lovelace") produces "Lovelace, Ada Jr."; combining it with a final uppercasing step via composeShaped results in "LOVELACE, ADA JR." @test

Limits arguments

  • Wrapping (a, b) => a - b with shapeArgs and maxArgs: 2 ensures a composed pipeline ignores extra inputs, so composeShaped([shapedSubtract])(10, 3, 99) returns 7 @test

Implementation

@generates

API

/**
 * Returns a function that remaps invocation arguments before calling `handler`.
 * - fromOriginal: positions (0-based) pulled from the incoming args in that order.
 * - append: values appended to the remapped list before calling the handler.
 * - maxArgs: caps how many arguments reach the handler after remapping/appending.
 */
export function shapeArgs(
  handler,
  options?: { fromOriginal?: number[]; append?: any[]; maxArgs?: number }
): (...args: any[]) => any;

/**
 * Composes the provided steps into a single callable.
 * - direction: "ltr" (default) runs steps in array order; "rtl" runs them from right to left.
 * - The first executed step receives the original call arguments; each subsequent step receives the previous result.
 */
export function composeShaped(
  steps: Array<(...args: any[]) => any>,
  options?: { direction?: "ltr" | "rtl" }
): (...args: any[]) => any;

Dependencies { .dependencies }

lodash { .dependency }

Utility helpers for function composition, argument remapping, and arity control.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-lodash-kebabcase

tile.json