intersects
intersects(
a,b,opts?):boolean
Do two segment-patterns share a common matching path? The load-bearing primitive: every other question in the library is a shape over it.
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”boolean
true when some path matches both a and b, else false.
Remarks
Section titled “Remarks”A pattern with no wildcards is an exact-path match, so two literal
segment arrays intersect only when equal. Subtrees are opted into with **.
Example
Section titled “Example”intersects(["src", "**", "*.vue"], ["src", "siteA", "components", "Button.vue"]); // trueintersects(["src", "api", "**"], ["src", "web", "**"]); // false