docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
Build a file filtering utility that works consistently across Windows and Unix-like systems by normalizing path separators before matching.
Your utility should normalize paths to use forward slashes before matching them against glob patterns, ensuring consistent behavior regardless of the platform where paths originated.
["src\\components\\App.js", "src/utils/helper.js", "tests\\unit\\app.test.js"] and pattern "src/**/*.js", returns the two files under src (normalized paths) @test["docs\\README.md", "src/index.ts"] and pattern "**/*.md", returns only the markdown file with normalized path @test["C:\\projects\\app.js", "home/user/script.js"] and pattern "**/*.js", returns both files with normalized forward slashes @testSupport matching files by basename only, ignoring their directory structure.
["src/components/Button.tsx", "tests/Button.tsx", "docs/Button.md"] and pattern "Button.tsx" with basename matching, returns both .tsx files @test["a/b/c/test.js", "x/y/test.js", "test.js"] and pattern "test.js" with basename matching, returns all three files @test/**
* Filters an array of file paths against a glob pattern with cross-platform path normalization.
*
* @param {string[]} paths - Array of file paths (may use backslashes or forward slashes)
* @param {string} pattern - Glob pattern to match against
* @param {Object} [options] - Optional configuration
* @param {boolean} [options.basename] - If true, match against basename only
* @returns {string[]} - Filtered array of paths with normalized separators (forward slashes)
*/
function filterPaths(paths, pattern, options = {}) {
// IMPLEMENTATION HERE
}
module.exports = { filterPaths };Provides glob pattern matching with cross-platform path normalization support.