docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
Build a utility that analyzes glob patterns and provides insights about their structure and characteristics.
Implement a function analyzePattern that takes a glob pattern string and returns an object containing information about the pattern's structure. The function should:
**) segments!)The returned object should have the following properties:
hasGlobstar (boolean): true if the pattern contains **isNegated (boolean): true if the pattern starts with !segments (array): array of path segments from the patternAdditionally, implement a function batchAnalyze that takes an array of glob patterns and returns an array of analysis objects for each pattern.
"src/**/*.js", the analyzer returns an object with hasGlobstar: true, isNegated: false, and segments including the pattern parts @test"!node_modules/**", the analyzer returns an object with hasGlobstar: true, isNegated: true, and appropriate segments @test"lib/utils/*.js", the analyzer returns an object with hasGlobstar: false, isNegated: false, and the correct segments @test/**
* Analyzes a glob pattern and returns structural information
* @param {string} pattern - The glob pattern to analyze
* @returns {object} Analysis object with hasGlobstar, isNegated, and segments properties
*/
function analyzePattern(pattern) {
// Implementation here
}
/**
* Analyzes multiple glob patterns
* @param {string[]} patterns - Array of glob patterns to analyze
* @returns {object[]} Array of analysis objects
*/
function batchAnalyze(patterns) {
// Implementation here
}
module.exports = {
analyzePattern,
batchAnalyze
};Provides glob pattern scanning and analysis capabilities.