CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-anymatch

tessl install tessl/npm-anymatch@3.1.0

Matches strings against configurable strings, globs, regular expressions, and/or functions

Agent Success

Agent success rate when using this tile

76%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.12x

Baseline

Agent success rate without this tile

68%

task.mdevals/scenario-7/

Reusable Matcher Utility

Builds a curried matcher from mixed criteria and reuses it for repeated filtering of path-like strings.

Capabilities

Curried tester from mixed matchers

  • Creating one tester from a glob and a regex returns true for matching paths like src/utils/file.js and false for non-matching entries like README.md, even when reused across multiple invocations. @test

Predicate and array forwarding

  • The tester accepts array input where the first element is matched while remaining elements flow into a predicate matcher to enforce extra constraints. @test

Return index on demand

  • Invoking the tester with returnIndex yields the index of the first matching matcher (e.g., 1 for a regex hit) or -1 when nothing matches. @test

Filtering with reusable tester

  • Using the curried tester as a filter callback over a list keeps only matching entries, demonstrating reuse without rebuilding the matcher. @test

Implementation

@generates

API

/**
 * Builds a reusable matcher from a list of matchers and optional glob options.
 * @param {Array<string|RegExp|Function>|string|RegExp|Function} matchers
 * @param {object} [options]
 * @returns {(value: string|string[], returnIndex?: boolean) => boolean|number}
 */
export function createReusableTester(matchers, options);

/**
 * Filters a list of values using a reusable tester; when returnIndex is true it maps to matcher indices instead of values.
 * @param {Array<string|string[]>} values
 * @param {(value: string|string[], returnIndex?: boolean) => boolean|number} tester
 * @param {boolean} [returnIndex]
 * @returns {Array<string|number>}
 */
export function filterWithTester(values, tester, returnIndex);

Dependencies { .dependencies }

anymatch { .dependency }

Provides curried matcher generation for strings, globs, regexes, and predicate functions.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/anymatch@3.1.x
tile.json