Class: EuroDreams
Defined in: lottery/eurodreams.ts:26
Class representing the EuroDreams lottery.
EuroDreams is a lottery game where players choose 6 main numbers from 1 to 40 and 1 dream number from 1 to 5. The total number of combinations is 3,838,380 for the main numbers and 5 for the dream numbers. In total, there are 19,191,900 possible combinations.
Draws take place every Monday and Thursday.
Example
const lottery = new EuroDreams();
lottery.drawDays; // DrawDays instance
lottery.combinationFactory; // EuroDreamsCombination factory
lottery.getCombination({ numbers: [1,2,3,4,5,6], dream: [1] });
Extends
Constructors
Constructor
new EuroDreams():
EuroDreams
Defined in: lottery/eurodreams.ts:27
Returns
EuroDreams
Overrides
Accessors
combinationFactory
Get Signature
get combinationFactory():
CombinationFactory
Defined in: lottery/base-lottery.ts:94
Return the combination factory associated with this lottery.
Example
const lottery = new BaseLottery({ combinationFactory: EuroMillionsCombination });
const factory = lottery.combinationFactory; // EuroMillionsCombination factory function
const combination = factory({ numbers: [1, 2, 3], stars: [1] }); // EuroMillionsCombination instance
Returns
The factory function used to create combinations.
Inherited from
BaseLottery.combinationFactory
drawDays
Get Signature
get drawDays():
DrawDays
Defined in: lottery/base-lottery.ts:78
Return the DrawDays instance associated with this lottery.
Example
const lottery = new BaseLottery({ drawDays: [Weekday.MONDAY, Weekday.THURSDAY] });
lottery.drawDays; // DrawDays instance with Monday and Thursday
Returns
The DrawDays instance configured for this lottery.
Inherited from
Methods
generate()
generate(
options?):LotteryCombination[]
Defined in: lottery/base-lottery.ts:154
Generate a list of random lottery combinations from the configured combination factory.
Parameters
options?
Options controlling generation.
n?
number = 1
Number of combinations to generate (default 1).
partitions?
number = 1
Number of partitions to use when ranking/generating.
(default 1).
Returns
An array of lottery combinations produced by the factory.
Example
const lottery = new BaseLottery({ combinationFactory: EuroMillionsCombination });
const combinations = lottery.generate({ n: 2 });
Inherited from
getCombination()
getCombination(
components):LotteryCombination
Defined in: lottery/base-lottery.ts:171
Create a lottery combination from the provided components using the configured factory.
Parameters
components
Record\<string, CombinationInputOrRank>
Component values or ranks forwarded to the factory.
Returns
A lottery combination produced by the factory.
Example
const lottery = new BaseLottery({ combinationFactory: EuroMillionsCombination });
const ticket = lottery.getCombination({ numbers: [1, 2, 3, 4, 5], stars: [1, 2] });
Inherited from
getLastDrawDate()
getLastDrawDate(
fromDate?,closest?):Date
Defined in: lottery/base-lottery.ts:114
Return the date of the last lottery draw according to the configured drawDays.
Parameters
fromDate?
Starting reference date. Accepted formats:
- A Unix timestamp in seconds.
- An ISO date string (YYYY-MM-DD).
- A Date object.
- A Weekday or other DayInput accepted by DrawDays.getLastDrawDate.
If omitted or null, the current date is used.
closest?
boolean = true
Whether to return the closest draw date if fromDate is
itself a draw day.
Returns
Date
A Date representing the last draw day on or before fromDate.
Throws
When fromDate is not a valid date input.
Throws
When fromDate string cannot be parsed.
Inherited from
getNextDrawDate()
getNextDrawDate(
fromDate?,closest?):Date
Defined in: lottery/base-lottery.ts:134
Return the date of the next lottery draw according to the configured drawDays.
Parameters
fromDate?
Starting reference date. Accepted formats:
- A Unix timestamp in seconds.
- An ISO date string (YYYY-MM-DD).
- A Date object.
- A Weekday or other DayInput accepted by DrawDays.getNextDrawDate.
If omitted or null, the current date is used.
closest?
boolean = true
Whether to return the closest draw date if fromDate is
itself a draw day.
Returns
Date
A Date representing the next draw day on or after fromDate.
Throws
When fromDate is not a valid date input.
Throws
When fromDate string cannot be parsed.