or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-3/

File Path Validator

Build a utility that validates file paths against inclusion and exclusion patterns, commonly used in build tools and configuration systems.

Capabilities

Pattern Matching

  • It correctly identifies when a file path matches a single glob pattern @test
  • It correctly identifies when a file path does NOT match a pattern @test
  • It handles multiple inclusion patterns where any match is valid @test
  • It properly handles wildcard patterns like *.js and *.{ts,tsx} @test

Inclusion and Exclusion Rules

  • It validates paths against both inclusion and exclusion patterns @test
  • It returns false when a path matches an exclusion pattern, even if it matches inclusion patterns @test
  • It correctly handles patterns with directory paths like src/**/*.js @test

Implementation

@generates

API

/**
 * Validates whether a file path should be included based on inclusion and exclusion patterns.
 *
 * @param {string} filePath - The file path to validate
 * @param {string|string[]} includePatterns - Pattern(s) that files must match to be included
 * @param {string|string[]} [excludePatterns] - Optional pattern(s) that exclude files from matching
 * @returns {boolean} True if the path matches include patterns and doesn't match exclude patterns
 */
function validatePath(filePath, includePatterns, excludePatterns) {
  // IMPLEMENTATION HERE
}

module.exports = { validatePath };

Dependencies { .dependencies }

picomatch { .dependency }

Provides fast and accurate glob pattern matching capabilities.