Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
implementation for a Set type which supports union, intersection, etc.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

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;
Something went wrong with that request. Please try again.