JSFiddle - React, Tailwind, and code Playground
JavaScript
var original = [
[1, 2, 3],
['one', 'two'],
['blue', 'black', 'red', 'green']
];
// get number of elements that will be in this array
var repeat = _.reduce(original, function (count, options) {
return count * options.length;
}, 1);
var master = [];
_.each(original, function (options, index) {
var count = options.length > 0 ? (repeat / options.length) : repeat,
optionsRepeated = [];
_(count).times(function () {
optionsRepeated = optionsRepeated.concat(options)
});
master[index] = optionsRepeated;
});
master = _.zip.apply(_, master);
console.log(master);