witness
witness(
a,b,opts?):SegmentPattern|null
An example common path (the reachability witness), or null when disjoint.
Turns “these overlap” into “these overlap at X”. The witness is free — it is
the path the engine already walked to prove intersects.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
a | SegmentPattern | The first segment-pattern. |
b | SegmentPattern | The second segment-pattern. |
opts? | Options | Matching semantics (Options); defaults apply when omitted. |
Returns
Section titled “Returns”SegmentPattern | null
A SegmentPattern both a and b match, or null if none exists.
Remarks
Section titled “Remarks”A segment of the witness may be the empty string — legal here, since
this layer answers in segment vectors. The path API’s witness stringifies,
and skips a vector whose LAST segment is empty: parse normalizes a trailing
separator back off, so no path string spells it.
Example
Section titled “Example”witness(["src", "api", "**"], ["src", "**", "handler.ts"]); // ["src", "api", "handler.ts"]witness(["src", "api", "**"], ["src", "web", "**"]); // null