Batman.js is no longer in production at Shopify and is not actively maintained.

This website is left for reference (and for old times' sake).

batman.js

Batman.SetComplement extends Batman.BinarySetOperation. It implements a complement operation: it contains the members of left which aren't in right.

Since Batman.SetComplement is a subclass of Batman.Set, you can use it just like a Batman.Set.

test 'SetComplement contains the complement of two sets', ->
  left = new Batman.Set(1, 2, 3)
  right = new Batman.Set(3, 4, 5)
  operation = new Batman.SetComplement(left, right)
  ok operation.has(1), 'has items from the left set only'
  ok !operation.has(4), 'doesnt have items from the right set only'
  ok !operation.has(3), 'doesnt have items from both sets'

Help us improve our documentation!

Contributions to this page are welcome on Github. If you find a problem but you cannot fix it, please open an issue.

Discussion regarding batman.js documentation is also welcome on our mailing list.