implementation for a Set type which supports union, intersection, etc.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README
set.js
tests.js

README

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;