(scopes: readonly string[])
| 168 | * empties, de-dupe (order-preserving). A scope set is compared as a SET — |
| 169 | * duplicates and blanks never widen it. */ |
| 170 | const normalizeScopes = (scopes: readonly string[]): readonly string[] => { |
| 171 | const seen = new Set<string>(); |
| 172 | const out: string[] = []; |
| 173 | for (const raw of scopes) { |
| 174 | const scope = canonicalScope(raw.trim()); |
| 175 | if (scope.length === 0 || seen.has(scope)) continue; |
| 176 | seen.add(scope); |
| 177 | out.push(scope); |
| 178 | } |
| 179 | return out; |
| 180 | }; |
| 181 | |
| 182 | /** Scopes in `needed` that `granted` does NOT cover — generic set difference |
| 183 | * (needed − granted), order-preserving. Empty when `granted` is a superset/equal |
no test coverage detected