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

Flexible Matcher Filter

Build a helper that filters path-like strings using mixed matching rules.

Capabilities

Supports mixed matcher types

  • A value equal to "logs/app.log" matches when matchers include that exact string. @test
  • "src/utils/math.js" matches when matchers include the glob "src/**/*.js". @test
  • "README.md" matches when matchers include a regular expression anchored to "^README". @test
  • "server.js" matches when matchers include a predicate that returns true for values containing "server". @test

Filters collections

  • Given ["src/index.js", "docs/guide.md", "scripts/build.mjs"] and matchers ["src/**/*.js", /\.md$/], returns ["src/index.js", "docs/guide.md"] preserving order. @test

Implementation

@generates

API

/**
 * Returns entries from `inputs` that satisfy at least one matcher.
 * @param {string[]} inputs
 * @param {string|RegExp|Function|(string|RegExp|Function)[]} matchers
 * @returns {string[]}
 */
export function filterMatches(inputs, matchers);
  • inputs is an array of strings to test.
  • matchers is a string, a glob string, a RegExp, a predicate function (value) => boolean, or an array combining them.
  • Matching is case-sensitive.
  • Returns a new array containing only the entries from inputs that satisfy at least one matcher.

Dependencies { .dependencies }

anymatch { .dependency }

Provides string, glob, regex, and predicate-based matching.

Version

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