combinations
combinations copied to clipboard
returns excess combinations if min/max are the same
var combinations = require('combinations');
var arr = ['red', 'orange', 'yellow', 'green'];
combinations(arr, 2, 2)
Yields 12 combinations, including some that have 3 elements. Was expecting an array of size 6, with each result having exactly 2 elements.
Same here
if (got.length > 0 && got.length === max) { all[all.length] = got; } return;
Add this condition to solve your issue.