permutaciones con repeticion javascript
function permutator (input) {
var set =[];
function permute (arr, data) {
var cur, memo = data || [];
for (var i = 0; i < arr.length; i++) {
cur = arr.splice(i, 1)[0];
if (arr.length === 0) set.push(memo.concat([cur]));
permute(arr.slice(), memo.concat([cur]));
arr.splice(i, 0, cur);
}
return set;
}
return permute(input);
}