Skip to content

Commit

Permalink
minor cleanup (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcarmon committed Dec 26, 2021
1 parent 1d24801 commit fedf92e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/chance.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,12 @@
throw new RangeError("Chance: Cannot pickset() from an empty array");
}
if (count < 0) {
throw new RangeError("Chance: Count must be a positive number");
throw new RangeError("Chance: Count must be a non-negative number");
}
if (!count || count === 1) {
return [ this.pickone(arr) ];
} else {
return this.shuffle(arr).slice(0, count);
}
}
return this.shuffle(arr).slice(0, count);
};

Chance.prototype.shuffle = function (arr) {
Expand Down

0 comments on commit fedf92e

Please sign in to comment.