CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-picomatch

Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.

83

1.45x
Overview
Eval results
Files

task.mdevals/scenario-1/

Glob Pattern Analyzer

A utility that analyzes glob patterns and provides detailed information about their structure and components.

Capabilities

Pattern Structure Detection

  • Given the pattern ".js", the analyzer identifies it as a glob pattern and returns that the base is empty and the glob portion is ".js" @test
  • Given the pattern "src/.js", the analyzer identifies that the base is "src" and the glob portion is ".js" @test
  • Given the pattern "docs/api/**/*.md", the analyzer detects that it contains a globstar pattern @test

Negation and Special Pattern Recognition

  • Given the pattern "!*.test.js", the analyzer detects that the pattern is negated @test
  • Given the pattern "src/!(test|spec)/*.js", the analyzer identifies that it contains an extglob pattern @test
  • Given the pattern "file.{js,ts,jsx}", the analyzer recognizes that it contains a brace pattern @test

Token-Level Analysis

  • Given the pattern "src/**/*.{js,ts}", the analyzer provides detailed token breakdown showing individual pattern components @test

Implementation

@generates

API

/**
 * Analyzes a glob pattern and returns its structural information.
 *
 * @param {string} pattern - The glob pattern to analyze.
 * @returns {object} An object containing:
 *   - isGlob: boolean indicating if pattern contains glob characters
 *   - base: string of the leading non-glob path portion
 *   - glob: string of the actual glob pattern portion
 *   - negated: boolean indicating if pattern starts with '!'
 *   - isGlobstar: boolean indicating if pattern contains '**'
 *   - isExtglob: boolean indicating if pattern contains extglob patterns
 *   - isBrace: boolean indicating if pattern contains brace patterns
 */
function analyzePattern(pattern) {
  // IMPLEMENTATION HERE
}

/**
 * Parses a glob pattern and returns detailed token information.
 *
 * @param {string} pattern - The glob pattern to parse.
 * @returns {object} A detailed state object containing token array and regex output.
 */
function parsePattern(pattern) {
  // IMPLEMENTATION HERE
}

module.exports = {
  analyzePattern,
  parsePattern,
};

Dependencies { .dependencies }

picomatch { .dependency }

Provides glob pattern matching and analysis capabilities.

Install with Tessl CLI

npx tessl i tessl/npm-picomatch

tile.json