Function
hasNear
(
normalized: string,
matchStart: number,
matchEnd: number,
nearRegex: RegExp,
window: number,
)
Source from the content-addressed store, hash-verified
| 225 | // ── Proximity check ─────────────────────────────────────────────────────────── |
| 226 | |
| 227 | function hasNear( |
| 228 | normalized: string, |
| 229 | matchStart: number, |
| 230 | matchEnd: number, |
| 231 | nearRegex: RegExp, |
| 232 | window: number, |
| 233 | ): boolean { |
| 234 | const from = Math.max(0, matchStart - window); |
| 235 | const to = Math.min(normalized.length, matchEnd + window); |
| 236 | const slice = normalized.slice(from, to); |
| 237 | const re = new RegExp(nearRegex.source, nearRegex.flags.replace(/g/g, "")); |
| 238 | return re.test(slice); |
| 239 | } |
| 240 | |
| 241 | // ── Email allowlist ─────────────────────────────────────────────────────────── |
| 242 | |
Tested by
no test coverage detected