The lodash method kebabCase exported as a standalone Node.js module for converting strings to kebab-case format
Overall
score
68%
Evaluation — 68%
↑ 1.08xAgent success when using this tile
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.
[1, 2, 3, 4, 5] and a batch size of 2, return [[1, 2], [3, 4], [5]], keeping item order intact. @test["a", "a", "b", "c", "b"], return ["a", "b", "c"], keeping the first appearance of each value. @testcurrent = [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. @testnested = [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@generates
/**
* 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);Provides array transformation utilities.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-lodash-kebabcasedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10