unionWith
Import from @varavel/vdl-plugin-sdk/utils/arrays.
Creates an array of unique values from two given arrays based on a custom equality function.
This function takes two arrays and a custom equality function, merges the arrays, and returns a new array containing only the unique values as determined by the custom equality function.
Type Parameters
| Type Parameter | Description |
|---|---|
T |
The type of elements in the array. |
Parameters
| Parameter | Type | Description |
|---|---|---|
arr1 |
readonly T[] |
The first array to merge and filter for unique values. |
arr2 |
readonly T[] |
The second array to merge and filter for unique values. |
areItemsEqual |
(item1, item2) => boolean |
A custom function to determine if two elements are equal. It takes two arguments and returns true if the elements are considered equal, and false otherwise. |
Returns
T[]
A new array of unique values based on the custom equality function.