Skip to content

Commit

Permalink
feat: allow empty entries when constructor MagicLottery
Browse files Browse the repository at this point in the history
  • Loading branch information
logeast committed Aug 1, 2023
1 parent 73fe538 commit 8123078
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/vanilla-basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"vite": "^4.4.5"
},
"dependencies": {
"magic-lottery": "^1.2.3"
"magic-lottery": "^1.2.4"
}
}
8 changes: 4 additions & 4 deletions examples/vanilla-basic/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/vanilla-basic/src/lottery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import MagicLottery from "magic-lottery";

const lottery = new MagicLottery();
const lottery = new MagicLottery([]);

export function setupCounter(element: HTMLButtonElement) {
let counter = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MagicLottery<T> {
private channelName?: string;
private replacement: boolean;

constructor(entries: T[], options: Options<T> = {}) {
constructor(entries: T[] = [], options: Options<T> = {}) {
this.entries = entries;

this.shuffle = options.shuffle || this.defaultShuffle;
Expand Down

0 comments on commit 8123078

Please sign in to comment.