Skip to main content
Version: Current

is_literal_source

@rotorsoft/act-root


@rotorsoft/act-root / act/src / is_literal_source

Function: is_literal_source()

is_literal_source(source): boolean

Defined in: libs/act/src/utils.ts:115

True when source is a literal stream name โ€” it carries no regex metacharacter, so every adapter treats it as an exact match. This is the fast, index-friendly path and covers every autoclose/dynamic-resolver source (bare stream names). A false return means the source is a pattern (contains ^ $ . * + ? ( ) [ ] { } | \) and must be compiled as a RegExp before matching โ€” the shape the calculator's static source: "^(A|B)$" reaction relies on.

The single source of truth for literal-vs-pattern classification across the InMemory has-work probe, the drain fetch path, and the SQL adapters, so all three agree on which sources take the exact path.

Parametersโ€‹

sourceโ€‹

string

Returnsโ€‹

boolean

Exampleโ€‹

is_literal_source("Board"); // โ†’ true (exact lookup)
is_literal_source("^(A|B)$"); // โ†’ false (compile as RegExp)