SetTuple<T>
Set constructor that only accepts string values.
Extends
Set
<T
>
Type Parameters
Type Parameter |
---|
T extends string |
Constructors
new SetTuple()
new SetTuple<T>(values?): SetTuple<T>
Parameters
Parameter | Type |
---|---|
values ? | null | readonly T [] |
Returns
SetTuple
<T
>
Inherited from
Set<T>.constructor
new SetTuple()
new SetTuple<T>(iterable?): SetTuple<T>
Parameters
Parameter | Type |
---|---|
iterable ? | null | Iterable <T , any , any > |
Returns
SetTuple
<T
>
Inherited from
Set<T>.constructor
Properties
[toStringTag]
readonly [toStringTag]: string;
Inherited from
Set.[toStringTag]
size
readonly size: number;
Returns
the number of (unique) elements in Set.
Inherited from
Set.size
[species]
readonly static [species]: SetConstructor;
Inherited from
Set.[species]
Methods
[iterator]()
iterator: SetIterator<T>
Iterates over values in the set.
Returns
SetIterator
<T
>
Inherited from
Set.[iterator]
add()
add(value): this
Appends a new element with a specified value to the end of the Set.
Parameters
Parameter | Type |
---|---|
value | T |
Returns
this
Inherited from
Set.add
clear()
clear(): void
Returns
void
Inherited from
Set.clear
delete()
delete(value): boolean
Removes a specified value from the Set.
Parameters
Parameter | Type |
---|---|
value | T |
Returns
boolean
Returns true if an element in the Set existed and has been removed, or false if the element does not exist.
Inherited from
Set.delete
difference()
difference<U>(other): Set<T>
Type Parameters
Type Parameter |
---|
U |
Parameters
Parameter | Type |
---|---|
other | ReadonlySetLike <U > |
Returns
Set
<T
>
a new Set containing all the elements in this Set which are not also in the argument.
Inherited from
Set.difference
entries()
entries(): SetIterator<[T, T]>
Returns an iterable of [v,v] pairs for every value v
in the set.
Returns
SetIterator
<[T
, T
]>
Inherited from
Set.entries
find()
find<C>(predicate): undefined | T
Returns the value of the first element in the array where predicate is true, and undefined otherwise.
Type Parameters
Type Parameter |
---|
C extends (value ) => boolean |
Parameters
Parameter | Type |
---|---|
predicate | C |
Returns
undefined
| T
forEach()
forEach(callbackfn, thisArg?): void
Executes a provided function once per each value in the Set object, in insertion order.
Parameters
Parameter | Type |
---|---|
callbackfn | (value , value2 , set ) => void |
thisArg ? | any |
Returns
void
Inherited from
Set.forEach
has()
has(value): value is T
Parameters
Parameter | Type |
---|---|
value | undefined | null | string | T |
Returns
value is T
a boolean indicating whether an element with the specified value exists in the Set or not.
Overrides
Set.has
intersection()
intersection<U>(other): Set<T & U>
Type Parameters
Type Parameter |
---|
U |
Parameters
Parameter | Type |
---|---|
other | ReadonlySetLike <U > |
Returns
Set
<T
& U
>
a new Set containing all the elements which are both in this Set and in the argument.
Inherited from
Set.intersection
isDisjointFrom()
isDisjointFrom(other): boolean
Parameters
Parameter | Type |
---|---|
other | ReadonlySetLike <unknown > |
Returns
boolean
a boolean indicating whether this Set has no elements in common with the argument.
Inherited from
Set.isDisjointFrom
isSubsetOf()
isSubsetOf(other): boolean
Parameters
Parameter | Type |
---|---|
other | ReadonlySetLike <unknown > |
Returns
boolean
a boolean indicating whether all the elements in this Set are also in the argument.
Inherited from
Set.isSubsetOf
isSupersetOf()
isSupersetOf(other): boolean
Parameters
Parameter | Type |
---|---|
other | ReadonlySetLike <unknown > |
Returns
boolean
a boolean indicating whether all the elements in the argument are also in this Set.
Inherited from
Set.isSupersetOf
keys()
keys(): SetIterator<T>
Despite its name, returns an iterable of the values in the set.
Returns
SetIterator
<T
>
Inherited from
Set.keys
map()
map<C>(callback): ReturnType<C>[]
Maps the set to an array of values, transformed by the given callback.
Type Parameters
Type Parameter |
---|
C extends (value ) => unknown |
Parameters
Parameter | Type |
---|---|
callback | C |
Returns
ReturnType
<C
>[]
series()
series<C>(callback): Promise<void>
Iterates over the set, calling the given async callback for each value.
This is useful when you need to perform an async operation for each value in the set, while ensuring that the operations are performed in series.
Type Parameters
Type Parameter |
---|
C extends (value ) => Promise <unknown > |
Parameters
Parameter | Type |
---|---|
callback | C |
Returns
Promise
<void
>
symmetricDifference()
symmetricDifference<U>(other): Set<T | U>
Type Parameters
Type Parameter |
---|
U |
Parameters
Parameter | Type |
---|---|
other | ReadonlySetLike <U > |
Returns
Set
<T
| U
>
a new Set containing all the elements which are in either this Set or in the argument, but not in both.
Inherited from
Set.symmetricDifference
toJSON()
toJSON(): T[]
Returns
T
[]
Overrides
Set.toJSON
union()
union<U>(other): Set<T | U>
Type Parameters
Type Parameter |
---|
U |
Parameters
Parameter | Type |
---|---|
other | ReadonlySetLike <U > |
Returns
Set
<T
| U
>
a new Set containing all the elements in this Set and also all the elements in the argument.
Inherited from
Set.union
values()
values(): SetIterator<T>
Returns an iterable of values in the set.
Returns
SetIterator
<T
>
Inherited from
Set.values