MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / normalizeScopes

Function normalizeScopes

packages/react/src/plugins/oauth-reconnect.ts:170–180  ·  view source on GitHub ↗
(scopes: readonly string[])

Source from the content-addressed store, hash-verified

168 * empties, de-dupe (order-preserving). A scope set is compared as a SET —
169 * duplicates and blanks never widen it. */
170const 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

Callers 1

missingScopesFunction · 0.85

Calls 2

canonicalScopeFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected