[**@bondsports/general**](../README.md) • **Docs**

***

[@bondsports/general](../globals.md) / isIntersecting

# Function: isIntersecting()

> **isIntersecting**\<`T`\>(`array`, `other`): `boolean`

Checks if two arrays have any common elements.

This function verifies whether the provided arrays intersect.
If either array is null or undefined, it returns false.
If both arrays are empty, it returns true, indicating they are considered to intersect.
If only one of the arrays is empty, it returns false.

## Type Parameters

• **T**

The type of elements in the arrays.

## Parameters

• **array**: `T`[]

The first array to compare, which can be an array of type T, undefined, or null.

• **other**: `T`[]

The second array to compare, which can be an array of type T, undefined, or null.

## Returns

`boolean`

- Returns true if the arrays have common elements,
                     false if they do not or if either input is null/undefined.

## Examples

```ts
returns true
isIntersecting([1, 2, 3], [3, 4, 5]);
```

```ts
returns false
isIntersecting([1, 2, 3], [4, 5, 6]);
```

```ts
returns true
isIntersecting([], []);
```

```ts
returns false
isIntersecting(null, [1, 2, 3]);
```

```ts
returns false
isIntersecting([1, 2, 3], undefined);
```

## Defined in

[utils/array.util.ts:348](https://github.com/Bond-Sports/bondUtils/blob/545f16ceb055481acfd7641d7809c0f252d3a5e6/packages/general/src/utils/array.util.ts#L348)
