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): Set<T>
Defined in: functions/set.ts:32
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
Set
<T
>
copySet()
function copySet<T>(oldSet): Set<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
Set
<T
>
objectKeysToReadonlySet()
function objectKeysToReadonlySet<K, V>(object): ReadonlySet<K>
Defined in: functions/set.ts:59
Helper function to convert the keys of an object to a read-only set.
Also see the objectKeysToSet
function.
Type Parameters
Type Parameter |
---|
K extends string | number | symbol |
V |
Parameters
Parameter | Type |
---|---|
object | Record <K , V > |
Returns
ReadonlySet
<K
>
objectKeysToSet()
function objectKeysToSet<K, V>(object): Set<K>
Defined in: functions/set.ts:71
Helper function to convert the keys of an object to a set.
Also see the objectKeysToReadonlySet
function.
Type Parameters
Type Parameter |
---|
K extends string | number | symbol |
V |
Parameters
Parameter | Type |
---|---|
object | Record <K , V > |
Returns
Set
<K
>
objectValuesToReadonlySet()
function objectValuesToReadonlySet<K, V>(object): ReadonlySet<V>
Defined in: functions/set.ts:88
Helper function to convert the values of an object to a read-only set.
Also see the objectValuesToSet
function.
Type Parameters
Type Parameter |
---|
K extends string | number | symbol |
V |
Parameters
Parameter | Type |
---|---|
object | Record <K , V > |
Returns
ReadonlySet
<V
>
objectValuesToSet()
function objectValuesToSet<K, V>(object): Set<V>
Defined in: functions/set.ts:101
Helper function to convert the values of an object to a set.
Also see the objectValuesToReadonlySet
function.
Type Parameters
Type Parameter |
---|
K extends string | number | symbol |
V |
Parameters
Parameter | Type |
---|---|
object | Record <K , V > |
Returns
Set
<V
>
setAdd()
function setAdd<T>(set, ...elements): void
Defined in: functions/set.ts:120
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:133
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