Set
Helper functions that have to do with sets.
Functions
addSetsToSet()
function addSetsToSet<T>(mainSet, ...setsToAdd): void;
Defined in: functions/set.ts:14
Helper function to add all of the values in one set to another set. The first set passed will be modified in place.
This function is variadic, meaning that you can specify N sets to add to the first set.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
mainSet | Set<T> |
...setsToAdd | readonly ReadonlySet<T>[] |
Returns
void
combineSets()
function combineSets<T>(...sets): ReadonlySet<T>;
Defined in: functions/set.ts:31
Helper function to create a new set that is the composition of two or more sets.
This function is variadic, meaning that you can specify N sets.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
...sets | readonly ReadonlySet<T>[] |
Returns
ReadonlySet<T>
copySet()
function copySet<T>(oldSet): ReadonlySet<T>;
Defined in: functions/set.ts:45
Helper function to copy a set. (You can also use a Set constructor to accomplish this task.)
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
oldSet | ReadonlySet<T> |
Returns
ReadonlySet<T>
objectKeysToSet()
function objectKeysToSet<K, V>(object): ReadonlySet<K>;
Defined in: functions/set.ts:55
Helper function to convert the keys of an object to a set.
Type Parameters
| Type Parameter |
|---|
K extends string | number | symbol |
V |
Parameters
| Parameter | Type |
|---|---|
object | Record<K, V> |
Returns
ReadonlySet<K>
objectValuesToSet()
function objectValuesToSet<K, V>(object): ReadonlySet<V>;
Defined in: functions/set.ts:68
Helper function to convert the values of an object to a set.
Type Parameters
| Type Parameter |
|---|
K extends string | number | symbol |
V |
Parameters
| Parameter | Type |
|---|---|
object | Record<K, V> |
Returns
ReadonlySet<V>
setAdd()
function setAdd<T>(set, ...elements): void;
Defined in: functions/set.ts:87
Helper function to add one or more elements to a set at once without having to repeatedly call
the Set.add method.
This function is variadic, meaning that you can pass as many things as you want to add.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
set | Set<T> |
...elements | readonly T[] |
Returns
void
setHas()
function setHas<T>(set, ...elements): boolean;
Defined in: functions/set.ts:100
Helper function to check for one or more elements in a set at once without having to repeatedly
call the Set.has method.
This function is variadic, meaning that you can pass as many things as you want to check for. It will return true if one or more elements are found.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
set | ReadonlySet<T> |
...elements | readonly T[] |
Returns
boolean