Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (28 sloc) 543 Bytes
A Set data type with the following methods.
+ add
+ clear
+ copy
+ contains
+ difference
+ differenceUpdate
+ foreach
+ fromArray
+ intersection
+ intersectionUpdate
+ isDisjoint
+ isSubset
+ isSuperset
+ remove
+ size
+ symmetricDifference
+ toArray
+ union
+ unionUpdate
example:
var set1 = new Set()
var set2 = new Set()
set1.fromArray([1, 2, 3])
set2.fromArray([3, 4, 5])
set1.union(set2) => Set<1, 2, 3, 4, 5>
set1.intersection(set2) => Set<3>
see tests.js for more examples;