-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(#491): use service for wine logic
- Loading branch information
1 parent
c8e4717
commit 83e2d09
Showing
2 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* @typedef {import('../enums').grapeVariety} grapeVarietyEnum | ||
*/ | ||
|
||
import { wineVarietyValueMap } from '../data/crops/grape' | ||
|
||
export class WineService { | ||
/** | ||
* @private | ||
*/ | ||
maturityDayMultiplier = 3 | ||
|
||
/** | ||
* @param {grapeVarietyEnum} grapeVariety | ||
*/ | ||
getDaysToMature = grapeVariety => { | ||
return wineVarietyValueMap[grapeVariety] * this.maturityDayMultiplier | ||
} | ||
} | ||
|
||
export const wineService = new WineService() |