intersects
Simple helper that check if two lists shared at least an item in common.
null and undefined are treated as empty arrays and return false.
Available since v1.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
a | readonly T[] | null | undefined | One list |
b | readonly T[] | null | undefined | Another list |
Returns
Section titled “Returns”boolean — true if one item is in common, false otherwise.
Examples
Section titled “Examples”Detect shared element
Section titled “Detect shared element”Returns true when at least one element is shared between both arrays.
No common elements
Section titled “No common elements”Returns false when no elements are shared.
