Function: matchesSubscription()
Makaio Framework / bus-core / matchesSubscription
Function: matchesSubscription()
Section titled “Function: matchesSubscription()”matchesSubscription(
subject,pattern):boolean
Defined in: ../../../packages/bus-core/src/utils/subscription-matching.ts:78
Check if a subject matches a subscription pattern.
Patterns can be:
- Exact match: ‘adapter:claudeCode.log’ matches only ‘adapter:claudeCode.log’
- Subject wildcard: ‘adapter:claudeCode.*’ matches ‘adapter:claudeCode.log’, ‘adapter:claudeCode.initialized’
- Namespace wildcard: ‘adapter:*’ matches subjects from child namespaces
Parameters
Section titled “Parameters”subject
Section titled “subject”string
Subject to match (e.g., ‘adapter:claudeCode:sdk.thinking’)
pattern
Section titled “pattern”string
Subscription pattern (e.g., ‘adapter:’, ‘adapter:claudeCode.’, ‘adapter:claudeCode.log’)
Returns
Section titled “Returns”boolean
true if subject matches pattern
Example
Section titled “Example”// Exact matchmatchesSubscription('adapter.log', 'adapter.log')// → true
// Subject wildcard - matches subjects in namespacematchesSubscription('adapter.log', 'adapter.*')// → truematchesSubscription('adapter.initialized', 'adapter.*')// → truematchesSubscription('adapter:claudeCode.log', 'adapter.*')// → false (different namespace - adapter:claudeCode vs adapter)
// Namespace wildcard - matches child namespacesmatchesSubscription('adapter:claudeCode.initialized', 'adapter:*')// → true (claudeCode is child of adapter)matchesSubscription('adapter:claudeCode:sdk.thinking', 'adapter:*')// → true (sdk is descendant of adapter)matchesSubscription('adapter:gpt.initialized', 'adapter:*')// → true (gpt is child of adapter)
// Multi-level namespace wildcardmatchesSubscription('adapter:claudeCode:sdk.thinking', 'adapter:claudeCode:*')// → true (sdk is child of adapter:claudeCode)matchesSubscription('adapter:gpt.initialized', 'adapter:claudeCode:*')// → false (different branch)