refactor: Deduplicate numericOnly helper in powerball and megamillions #13
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent: #3
Description
Both
sites/powerball/powerball.go:149-168andsites/megamillions/megamillions.go:171-190define identicalnumericOnlyinline functions for parsing jackpot amounts:Both also have identical jackpot multiplier logic for "Billion" and "Million" suffixes.
Fix
Extract a shared utility function, either in a
sites/lotterypackage or as an exported function in the extractor package.Starting work on this as part of PR 9 (also includes #14). Will extract
numericOnlytosites/internal/parse/parse.go.Work finished — extracted identical
numericOnlyfunctions from powerball and megamillions into sharedsites/internal/parse.NumericOnlywith unit tests. Merged in PR #40.