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

Negated Glob Filter

Build a small utility that filters file paths using positive and negated glob patterns, so that explicit exclusions override broad include rules.

Capabilities

Filters candidates with negated globs

  • Given patterns ["src/**/*.js", "!src/**/__tests__/**"] and candidates ["src/index.js", "src/__tests__/unit.js", "README.md"], the filtered result keeps only ["src/index.js"]. @test

Negated exclusions take precedence

  • Given patterns ["src/vendor/**/*.js", "!src/vendor/internal/**"] and candidates ["src/vendor/internal/secret.js", "src/vendor/public.js"], the filter removes any path matched by a negated glob even when it also matches a broader include, returning only ["src/vendor/public.js"]. @test

Reusable predicate for streaming inputs

  • A builder returns a predicate function that can be reused (e.g., as an Array filter callback) to apply the same include/negate rules without recomputing matchers. Using the predicate on ["logs/app.log", "logs/tmp/cache.tmp"] with patterns ["logs/**/*.log", "!**/tmp/**"] keeps only ["logs/app.log"]. @test

Implementation

@generates

API

/**
 * Returns a filtered list of candidate paths that match at least one positive glob and are not excluded by any negated glob.
 */
export function filterPaths(paths, patterns);

/**
 * Returns a predicate function that tests a single path using the provided patterns.
 * The predicate must respect negated globs overriding matches and be suitable for repeated calls.
 */
export function buildPathFilter(patterns);

Dependencies { .dependencies }

anymatch { .dependency }

Matches paths against glob patterns, including negated exclusions, to power the filter predicate.

Version

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