Function matches_ignore_patterns

Source
pub fn matches_ignore_patterns(path: &str, patterns: &[String]) -> bool
Expand description

Check if a path matches any of the specified ignore patterns

This function checks whether a given path contains any of the specified ignore patterns. This is used for filtering out unwanted files and directories during parsing operations.

§Arguments

  • path - The file path to check
  • patterns - Array of patterns to match against

§Returns

true if the path matches any pattern, false otherwise.

§Examples

use tree_parser::matches_ignore_patterns;
 
let patterns = vec!["target".to_string(), "node_modules".to_string()];
 
assert!(matches_ignore_patterns("src/target/debug", &patterns));
assert!(matches_ignore_patterns("frontend/node_modules/react", &patterns));
assert!(!matches_ignore_patterns("src/main.rs", &patterns));