UNPKG

@ocap/util

Version:

utils shared across multiple forge js libs, works in both node.js and browser

17 lines 634 B
//#region src/scope-match.d.ts /** * Check if a scope matches a pattern. * * Matching rules: * - Exact match: 'fg:t:transfer' matches 'fg:t:transfer' * - Wildcard: 'fg:t:transfer' matches 'fg:t:*' (pattern ends with ':*') * - Prefix with segment boundary: 'fg:x:connect:authPrincipal' matches 'fg:x:connect' * but 'fg:x:connectFoo' does NOT match 'fg:x:connect' */ declare function scopeMatch(scope: string, pattern: string): boolean; /** * Check if a scope matches any of the given patterns. */ declare function scopeMatchAny(scope: string, patterns: string[]): boolean; //#endregion export { scopeMatch, scopeMatchAny };