is_literal_source
@rotorsoft/act-root / act/src / is_literal_source
Function: is_literal_source()
is_literal_source(
source,target?):boolean
Defined in: libs/act/src/utils.ts:117
True when source is a stream's name, matched exactly. Only an anchored
source, one that starts with ^ or ends with $, is a pattern and gets
compiled as a RegExp. A name can hold any other character, so
user+tag@example.com and order(1) are names, and a pattern always says
that it is one.
Pass the subscription's target too when it's known: a target reading itself
holds a stream's name, whatever characters that name has.
The single source of truth for this across correlate (which decides what a source marks), the drain fetch path, the close check, and the adapters, so they all agree.
Parameters
source
string
target?
string
Returns
boolean
Example
is_literal_source("Board"); // → true (exact lookup)
is_literal_source("a+b"); // → true (exact lookup)
is_literal_source("^(A|B)$"); // → false (compile as RegExp)