any static method

bool any(
  1. List<String> patterns,
  2. String path
)

true when path matches one of patterns

Implementation

static bool any(List<String> patterns, String path) {
  for (String pattern in patterns) {
    String rule = pattern.startsWith('/') ? pattern : '/$pattern';
    if (rule.endsWith('*')) {
      if (path.startsWith(rule.substring(0, rule.length - 1))) return true;
    } else if (path == rule) {
      return true;
    }
  }
  return false;
}