Set
Helper functions that have to do with sets.
Functions
Section titled “Functions”addSetsToSet()
Section titled “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
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
mainSet |
Set<T> |
…setsToAdd |
readonly ReadonlySet<T>[] |
Returns
Section titled “Returns”void
combineSets()
Section titled “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
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…sets |
readonly ReadonlySet<T>[] |
Returns
Section titled “Returns”ReadonlySet<T>
copySet()
Section titled “copySet()”function copySet<T>(oldSet): ReadonlySet<T>;Defined in: functions/set.ts:45
Helper function to copy a set. (Under the hood, this simply calls the Set
constructor.)
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
oldSet |
ReadonlySet<T> |
Returns
Section titled “Returns”ReadonlySet<T>
objectKeysToSet()
Section titled “objectKeysToSet()”function objectKeysToSet<K, V>(object): ReadonlySet<K>;Defined in: functions/set.ts:50
Helper function to convert the keys of an object to a set.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends PropertyKey |
V |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
object |
Record<K, V> |
Returns
Section titled “Returns”ReadonlySet<K>
objectValuesToSet()
Section titled “objectValuesToSet()”function objectValuesToSet<K, V>(object): ReadonlySet<V>;Defined in: functions/set.ts:63
Helper function to convert the values of an object to a set.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends PropertyKey |
V |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
object |
Record<K, V> |
Returns
Section titled “Returns”ReadonlySet<V>
setAdd()
Section titled “setAdd()”function setAdd<T>(set, ...elements): void;Defined in: functions/set.ts:82
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
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
set |
Set<T> |
…elements |
readonly T[] |
Returns
Section titled “Returns”void
setHas()
Section titled “setHas()”function setHas<T>(set, ...elements): boolean;Defined in: functions/set.ts:95
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
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
set |
ReadonlySet<T> |
…elements |
readonly T[] |
Returns
Section titled “Returns”boolean
