Builds a path-exclusion predicate from a list of literals and patterns.
The list is partitioned ONCE, at construction: literals go into a Set so
the common case stays an O(1) hash lookup on the request hot path, and the
patterns are kept in an array walked only when the literal lookup misses.
An all-literal list — which is what every default in this framework is —
therefore costs exactly what the hand-rolled Set.has copies cost, and a
mixed list costs one hash lookup plus one pass over the patterns rather than
a typeof branch per entry per request.
lastIndex is reset before each .test. That is a correctness requirement,
not hygiene: RegExp.prototype.test on a g- or y-flagged pattern
advances lastIndex and resumes from it on the next call, so a shared
pattern would match the first request, miss the second, match the third.
Builds a path-exclusion predicate from a list of literals and patterns.
The list is partitioned ONCE, at construction: literals go into a
Setso the common case stays an O(1) hash lookup on the request hot path, and the patterns are kept in an array walked only when the literal lookup misses. An all-literal list — which is what every default in this framework is — therefore costs exactly what the hand-rolledSet.hascopies cost, and a mixed list costs one hash lookup plus one pass over the patterns rather than atypeofbranch per entry per request.lastIndexis reset before each.test. That is a correctness requirement, not hygiene:RegExp.prototype.teston ag- ory-flagged pattern advanceslastIndexand resumes from it on the next call, so a shared pattern would match the first request, miss the second, match the third.