witness
witness(
a,b,opts?):string|null
An example path common to both sets (turns “overlap” into “overlap at X”), or
null when disjoint.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
a | Patterns | The first pattern-set (Patterns). |
b | Patterns | The second pattern-set (Patterns). |
opts? | Options | Matching semantics (Options); defaults apply when omitted. |
Returns
Section titled “Returns”string | null
A concrete path matching both sets, or null if none exists.
Remarks
Section titled “Remarks”The returned string always matches both sets. A segment-vector that
no path string can spell — one ending in an empty segment, which only a
degenerate pattern such as {,x} produces — is not reported; for such a pair
this returns null even though intersects (which answers over segment
vectors, not path strings) says true.
Example
Section titled “Example”witness("src/api/**", "src/api/handler.ts"); // "src/api/handler.ts" — a path both matchwitness("src/api/**", "src/web/**"); // null — no common path