$.array.setOperations

Set operations (Union, Intersection, Complement, Difference)

Union of arrays

You may want to unite between 2 or more arrays uniquely, this is why we provide helper for that. Actually, you can use spread operator to do all of that[...Array1, ...Array2, ...ArrayN], but this way will allow duplication of data and not unique.

Intersection of arrays

If you do manually you only can do intersection for just 2 arrays, but our helper can intersect multiple arrays at once.

Complement of arrays

Complement also known as difference, the complement here is to remove only the first array by the same items from other arrays, we make this helper can accept multiple arrays or more than 2 arrays here.

Difference of arrays

Difference better known as symmetric difference, here we provide a helper for removing all the same items or elements of multiple arrays and return it as a new single array.

Last updated

Was this helpful?