evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
A utility for validating file paths against flexible naming patterns with optional components.
Create a function that validates file paths based on patterns where certain parts may be optional. The validator should handle paths where specific segments or characters can either be present or absent.
Implement a path validator that:
The validator should correctly identify matches for patterns with optional components:
.txt extension)/**
* Creates a path validator function from a pattern with optional components.
*
* @param {string} pattern - The pattern string with optional components
* @param {object} options - Configuration options for the validator
* @returns {function(string): boolean} A function that validates paths against the pattern
*/
function createValidator(pattern, options) {
// IMPLEMENTATION HERE
}
module.exports = { createValidator };Provides glob pattern matching support with extglob features.