@xylabs/set
v5.0.87
Published
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Readme
@xylabs/set
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Reference
@xylabs/set
Functions
| Function | Description |
| ------ | ------ |
| difference | Returns a new set containing elements in a that are not in b. |
| intersection | Returns a new set containing only elements present in both a and b. |
| union | Returns a new set containing all elements from both a and b. |
functions
difference
function difference<TKey>(a: Set<TKey>, b: Set<TKey>): Set<TKey>;Returns a new set containing elements in a that are not in b.
Type Parameters
| Type Parameter |
| ------ |
| TKey |
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| a | Set<TKey> | The source set |
| b | Set<TKey> | The set of elements to exclude |
Returns
Set<TKey>
A new set representing the difference of a and b
intersection
function intersection<TKey>(a: Set<TKey>, b: Set<TKey>): Set<TKey>;Returns a new set containing only elements present in both a and b.
Type Parameters
| Type Parameter |
| ------ |
| TKey |
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| a | Set<TKey> | The first set |
| b | Set<TKey> | The second set |
Returns
Set<TKey>
A new set representing the intersection of a and b
union
function union<TKey>(a: Set<TKey>, b: Set<TKey>): Set<TKey>;Returns a new set containing all elements from both a and b.
Type Parameters
| Type Parameter |
| ------ |
| TKey |
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| a | Set<TKey> | The first set |
| b | Set<TKey> | The second set |
Returns
Set<TKey>
A new set representing the union of a and b
Part of sdk-js
Maintainers
License
See the LICENSE file for license details
