Skip to content

Commit

Permalink
feat: sharable parameterized links (#13)
Browse files Browse the repository at this point in the history
* feat: sharable parameterized links

* chore: add test cases for calc
  • Loading branch information
shanehull authored Oct 16, 2024
1 parent e242906 commit 789b5e6
Show file tree
Hide file tree
Showing 17 changed files with 717 additions and 232 deletions.
8 changes: 4 additions & 4 deletions internal/calc/calc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
)

type DebtRecyclingParameters struct {
type Parameters struct {
Salary float64
InitialInvestment float64
AnnualInvestment float64
Expand All @@ -20,7 +20,7 @@ type DebtRecyclingParameters struct {
ReinvestTaxRefunds bool
}

type DebtRecyclingData struct {
type Data struct {
DebtRecycled []float64
NonDeductibleInterest []float64
TaxDeductibleInterest []float64
Expand Down Expand Up @@ -122,8 +122,8 @@ func CAGR(initialValue, finalValue float64, numYears int) float64 {
return math.Pow(finalValue/initialValue, 1/float64(numYears)) - 1
}

func DebtRecycling(params DebtRecyclingParameters) (*DebtRecyclingData, error) {
data := &DebtRecyclingData{}
func DebtRecycling(params Parameters) (*Data, error) {
data := &Data{}

// Pre-allocate slices with the correct size
data.DebtRecycled = make([]float64, params.NumYears)
Expand Down
Loading

0 comments on commit 789b5e6

Please sign in to comment.