Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (22 sloc) 554 Bytes
(function(host) {
function generateSets(elements, partialSets) {
partialSets = partialSets || [[]];
if (elements.length == 0) {
return partialSets;
} else {
var element = elements.shift();
var sets = partialSets.concat(partialSets.map(function(set) {
return set.concat(element);
}));
return generateSets(elements, sets);
}
}
var exported = {
sets: generateSets
};
if (module && module.exports) {
module.exports = exported;
} else {
host.Generator = exported;
}
})(this);