documentcloud/underscore-contrib — pull request #168 by krawaller (2014-08-14 15:23:47+00:00)
Title: Adding _.combine

This pull request implements a feature I've been missing; it returns an array of all possible combinations using one element each from the given arrays.

Each element in the return array with therefore contain as many elements as you fed `combine`, and the number of elements in the return array equals the product of the lengths of the given arrays.

Here's an example:
```
_.combine([1,2,3],["a","b"],[”foo","bar","baz"]);
// => [ [1,"a","foo"],[1,"a","bar"],[1,"a","baz"],[1,"b","foo"],[1,"b","bar"],[1,"b","baz"],[2,"a","foo"],[2,"a","bar"],[2,"a","baz"],[2,"b","foo"],[2,"b","bar"],[2,"b","baz"]]
```
This was deemed [not quite useful enough](https://github.com/jashkenas/underscore/pull/1788) for Underscore proper, but might qualify for _.contrib? I use it somewhat often, and as doing it "manually" is messy and verbose, a helper for this functionality really cleans up the code.