title: Cartesian product without duplicates
body: <p>I am using a cartesian product function that given <code>[1], [1,2,3], [1,2,3]</code> returns 9 combinations:</p>
  
  <pre><code>[ [ 1, 1, 1 ],
    [ 1, 2, 1 ],
    [ 1, 3, 1 ],
    [ 1, 1, 2 ],
    [ 1, 2, 2 ],
    [ 1, 3, 2 ],
    [ 1, 1, 3 ],
    [ 1, 2, 3 ],
    [ 1, 3, 3 ] ]
  </code></pre>
  
  <p>But I need to remove those with the same items regardless of the order, so <code>[ 1, 3, 1 ]</code> and <code>[ 1, 1, 3 ]</code> are the same to me. The result should contain 6 items:</p>
  
  <pre><code>[ [ 1, 1, 1 ],
    [ 1, 2, 1 ],
    [ 1, 3, 1 ],
    [ 1, 2, 2 ],
    [ 1, 3, 2 ],
    [ 1, 3, 3 ] ]
  </code></pre>
  
  <p>I can write a function that compares all possible pairs with <code>_.xor</code>, but for larger numbers it will probably be very inefficient. Is there a good way in Javascript to do this? An efficient way to compare all possible pairs or an algorithm for cartesian product without duplicates?</p>