Class SvelteSet<T>
Type Parameters
- T
Methods
[iterator]
-
Iterates over values in the set.
Returns SetIterator<T>
add
-
Appends a new element with a specified value to the end of the Set.
Parameters
- value: T
Value to add.
Returns this
This instance.
- value: T
clear
-
Clears this set.
Returns void
delete
-
Removes a specified value from the Set.
Parameters
- value: T
Value to delete.
Returns boolean
Returns true if an element in the Set existed and has been removed, or false if the element does not exist.
- value: T
difference
entries
-
Returns an iterable of [v,v] pairs for every value
vin the set.Returns SetIterator<[T, T]>
equals
every
-
Test whether every element in this Set satisfies a certain test criterion.
Parameters
Returns boolean
Does every element in the set satisfy the test criterion?
filter
find
-
Find the first element in this set which satisfies a certain test criterion.
Type Parameters
- F
Parameters
Returns F
The first element in the set which satisfies the test criterion, or undefined.
first
forEach
has
-
Parameters
- value: T
Returns boolean
a boolean indicating whether an element with the specified value exists in the Set or not.
intersection
intersects
isSubset
keys
-
Despite its name, returns an iterable of the values in the set.
Returns SetIterator<T>
map
reduce
some
-
Test whether any element in this Set satisfies a certain test criterion.
Parameters
Returns boolean
Does any element in the set satisfy the test criterion?
subscribe
-
Parameters
- handler: Subscriber<SvelteSet<T>>
Callback function that is invoked on update / changes.
Returns Unsubscriber
Unsubscribe function.
- handler: Subscriber<SvelteSet<T>>
toObject
-
Convert a set to a JSON object by mapping its contents to an array
Returns T[]
The set elements as an array.
values
-
Returns an iterable of values in the set.
Returns SetIterator<T>
Provides a Svelte 4 Readable store based Set implementation.
Note: This implementation will be removed in transition to Svelte 5.