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

Input Filter Validator

Build a small helper that validates matcher configuration and evaluates paths using flexible matcher types while tolerating unsupported entries.

Capabilities

Valid matcher requirement

  • Creating an evaluator without at least one matcher throws a TypeError. @test

Test input validation

  • Passing anything other than a string or tuple [string, ...extras] to the evaluator throws a TypeError. @test

Tuple-aware matching

  • Given matchers that include a predicate expecting forwarded extras, supplying ["src/app.js", { lang: "js" }] returns true when the predicate approves the meta; plain string inputs that do not satisfy any matcher return false. @test

Tolerant unsupported matcher handling

  • Matcher lists may contain unsupported entries (e.g., numbers or objects); they never throw. If only unsupported entries are provided, evaluating "any/path.js" returns false. When supported matchers are present and returnIndex is requested, the evaluator reports the index of the first supported match while skipping unsupported entries. @test

Implementation

@generates

API

/**
 * Creates an evaluator for matching paths against flexible matchers.
 *
 * @param {string|RegExp|Function|(string|RegExp|Function)[]} matchers - Required matchers to test paths against.
 * @param {object} [options] - Optional matching options passed to the underlying matcher engine.
 * @returns {(value: string | [string, ...unknown[]], opts?: { returnIndex?: boolean }) => boolean | number}
 * A function that evaluates a test value and returns either a boolean or the index of the first matching matcher (or -1 when none match) when returnIndex is true.
 */
export function createEvaluator(matchers, options) {}

Dependencies { .dependencies }

anymatch { .dependency }

Matches strings against glob, regexp, or predicate matchers while supporting optional return of the matching index and tolerant handling of unsupported matcher entries.

@satisfied-by

Version

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