Class SvelteSet<T>
Type Parameters
- T
Index
Constructors
Methods
Properties
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
Test whether this set is equal to some other set. Sets are equal if they share the same members, independent of order
Parameters
- other: Set<unknown>
Some other set to compare against
Returns boolean
Are the sets equal?
- other: Set<unknown>
every
filter
find
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
Test whether this set has an intersection with another set.
Parameters
- other: Set<unknown>
Another set to compare against
Returns boolean
Do the sets intersect?
- other: Set<unknown>
isSubset
Test whether this set is a subset of some other set. A set is a subset if all its members are also present in the other set.
Parameters
- other: Set<unknown>
Some other set that may be a subset of this one
Returns boolean
Is the other set a subset of this one?
- other: Set<unknown>
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>>
symmetricDifference
toObject
Convert a set to a JSON object by mapping its contents to an array
Returns T[]
The set elements as an array.
union
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.