or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-2/

File Extension Filter

A utility that filters file paths based on file extension patterns using glob matching.

Capabilities

Filters files by extension

  • Given an array of file paths, it returns only files matching a specific extension pattern (e.g., *.js) @test
  • It correctly handles multiple files with the same extension @test
  • It returns an empty array when no files match the pattern @test

Handles multiple extension patterns

  • It can filter files matching any of multiple extension patterns (e.g., both *.js and *.ts) @test

Respects path segment boundaries

  • A pattern like *.js matches file.js but not src/file.js @test

Implementation

@generates

API

/**
 * Filters an array of file paths based on one or more glob patterns.
 *
 * @param {string[]} paths - Array of file paths to filter
 * @param {string|string[]} patterns - Glob pattern(s) to match against
 * @returns {string[]} Array of paths that match the pattern(s)
 */
function filterFiles(paths, patterns) {
  // IMPLEMENTATION HERE
}

module.exports = {
  filterFiles
};

Dependencies { .dependencies }

micromatch { .dependency }

Provides glob matching support.