Skip to content

Commit

Permalink
fix(CLuster): group method brok in the case when reached a leaf
Browse files Browse the repository at this point in the history
  • Loading branch information
maasencioh committed Aug 31, 2016
1 parent 0e2a41a commit b09148f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js:
- "4"
- "6"
- "stable"
- 4
- 5
- stable
sudo: false
5 changes: 4 additions & 1 deletion src/Cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ Cluster.prototype.group = function (minGroups) {
var aux;
while (list.length < minGroups && list.length !== 0) {
aux = list.shift();
list = list.concat(aux.children);
if (aux.children)
list = list.concat(aux.children);
else
list.push(aux);
}
if (list.length === 0) throw new RangeError('Number of groups too big');
for (var i = 0; i < list.length; i++)
Expand Down

0 comments on commit b09148f

Please sign in to comment.