DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
    • can-component
    • can-compute
    • can-connect
    • can-define
    • can-define/list/list
    • can-define/map/map
    • can-route
    • can-route-pushstate
    • can-set
      • types
        • Set
        • Compares
        • Prop
      • properties
        • Algebra
          • prototype
            • difference
            • equal
            • getSubset
            • getUnion
            • has
            • index
            • intersection
            • properSubset
            • subset
            • union
        • Translate
        • props
    • can-stache
    • can-stache/helpers/route
    • can-stache-bindings
  • Ecosystem
  • Infrastructure
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Core
  • /
  • can-set
  • /
  • Algebra
  • /
  • difference
  • / On this page
    • difference

      function
      • source

      algebra.difference(a, b)

      Returns a set that represents the difference of sets A and B (A \ B), or returns if a difference exists.

      algebra1 = new set.Algebra(set.props.boolean("completed"));
      algebra2 = new set.Algebra();
      
      // A has all of B
      algebra1.difference( {} , {completed: true} ) //-> {completed: false}
      
      // A has all of B, but we can't figure out how to create a set object
      algebra2.difference( {} , {completed: true} ) //-> true
      
      // A is totally inside B
      algebra2.difference( {completed: true}, {} )  //-> false
      

      Parameters

      1. a {Set}:

        A set.

      2. b {Set}:

        A set.

      Returns

      {Set|Boolean}:

      If an object is returned, it is difference of sets A and B (A \ B).

      If true is returned, that means that B is a subset of A, but no set object can be returned that represents that set.

      If false is returned, that means there is no difference or the sets are not comparable.

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.