class
_Set
Source: classes.
Overrides the default set methods to use JSON.stringify
. This allows it to
work with objects and arrays. See the docs for the built in Set.
Child class
new _Set(iterable)
Creates a new set. Can also be done with constructors.S.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
iterable |
|
|
Optional iterable to initialize the set with |
- Extends
- Set
- Returns
Class
_Set
Methods
clone() → _Set
Makes a copy of the set
- Returns
diff(other) → _Set
Creates set difference in place with other
and returns this set
Example
S([1, 2, 3]).diff(S([3, 4, 5])) // { 1, 2 }
Parameter
Name | Type | Optional | Description |
---|---|---|---|
other |
|
- Returns
intersect(other) → _Set
Creates set intersection in place with other
and returns this set
Example
S([1, 2, 3]).intersect(S([3, 4, 5])) // { 3 }
Parameter
Name | Type | Optional | Description |
---|---|---|---|
other |
|
- Returns
symdiff(other) → _Set
Creates symmetric set difference in place with other
and returns this set
Example
S([1, 2, 3]).symdiff(S([3, 4, 5])) // { 1, 2, 4, 5 }
Parameter
Name | Type | Optional | Description |
---|---|---|---|
other |
|
- Returns
union(other) → _Set
Creates set union in place with other
and returns this set
Example
S([1, 2, 3]).union(S([3, 4, 5])) // { 1, 2, 3, 4, 5 }
Parameter
Name | Type | Optional | Description |
---|---|---|---|
other |
|
- Returns