or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-10/

File Path Exclusion Filter

Build a utility that filters file paths to identify files that should be excluded from a backup process based on configurable exclusion patterns.

Capabilities

Filter paths by exclusion patterns

The utility should identify files that do NOT match any of the given patterns. For example, when given a list of source file patterns, it should return all files that are NOT source files.

  • Given paths ['src/index.js', 'README.md', 'package.json', 'test/unit.test.js'] and patterns ['**/*.js'], returns ['README.md', 'package.json'] @test
  • Given paths ['docs/api.md', 'docs/guide.md', 'src/main.ts', 'README.txt'] and patterns ['**/*.md'], returns ['src/main.ts', 'README.txt'] @test

Handle multiple exclusion patterns

The utility should support multiple patterns and exclude paths that match ANY of them.

  • Given paths ['file.js', 'file.ts', 'file.css', 'file.txt'] and patterns ['*.js', '*.ts'], returns ['file.css', 'file.txt'] @test

Handle nested directory structures

The utility should correctly process paths with nested directory structures using globstar patterns.

  • Given paths ['src/components/Button.jsx', 'src/utils/helper.js', 'docs/README.md', 'config.json'] and patterns ['src/**/*.jsx', 'src/**/*.js'], returns ['docs/README.md', 'config.json'] @test

Implementation

@generates

API

/**
 * Filters a list of file paths to return only those that do NOT match any of the given glob patterns.
 *
 * @param {string[]} paths - Array of file paths to filter
 * @param {string | string[]} patterns - Glob pattern(s) to exclude
 * @returns {string[]} Array of paths that do not match any pattern
 */
function filterExcluded(paths, patterns) {
  // IMPLEMENTATION HERE
}

module.exports = { filterExcluded };

Dependencies { .dependencies }

micromatch { .dependency }

Provides glob pattern matching capabilities for filtering file paths.

@satisfied-by