social-security-calculator 0.0.11 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  import { Wages } from '../model';
2
- export declare function getEstimatedEarnings(age: number, lastWage: number, lastYearWorked?: number, earningGrowthRate?: number): Wages;
2
+ export declare function getEstimatedEarnings(birthDate: Date, lastWage: number, lastYearWorked?: number, earningGrowthRate?: number): Wages;
@@ -1,45 +1,53 @@
1
- import { wageIndex, quickCalcProjections, taxableMaximum } from '../wage-index';
1
+ import { wageIndex, wageIndexFuture, taxableMaximum, } from '../wage-index';
2
2
  const YOUTH_FACTOR = 8;
3
3
  const YOUTH_FACTOR_AGE = 21;
4
4
  const WORK_START_AGE = 18;
5
5
  const CURRENT_YEAR = new Date().getFullYear();
6
- export function getEstimatedEarnings(age, lastWage, lastYearWorked = CURRENT_YEAR, earningGrowthRate = 0) {
6
+ export function getEstimatedEarnings(birthDate, lastWage, lastYearWorked = CURRENT_YEAR, earningGrowthRate = 0) {
7
+ var _a;
8
+ const birthDateMinusOneDay = new Date(birthDate.getFullYear(), birthDate.getMonth(), birthDate.getDate() - 1);
9
+ const age = CURRENT_YEAR - birthDateMinusOneDay.getFullYear();
7
10
  if (age <= 22) {
8
- throw new Error('Age must be greater than 22');
11
+ // return zero
9
12
  }
10
13
  if (lastYearWorked > CURRENT_YEAR) {
11
14
  throw new Error('Last year worked cannot be in the future');
12
15
  }
13
16
  const workStartYear = CURRENT_YEAR - age + WORK_START_AGE;
14
17
  const yearTurned22 = CURRENT_YEAR - age + YOUTH_FACTOR_AGE;
15
- const wageResults = {};
18
+ const wageResults = [];
16
19
  for (let i = lastYearWorked; i >= workStartYear; i--) {
17
20
  const year = i;
18
21
  const nextYear = (i + 1);
22
+ // one-time age adjustment for youth
19
23
  const youthAdjustment = (i === yearTurned22 ? YOUTH_FACTOR : 1);
20
- wageResults[year] = (i === lastYearWorked)
21
- ? lastWage
22
- : wageResults[nextYear] * getReductionFactor(i) / (1 + earningGrowthRate) / youthAdjustment;
24
+ wageResults.push({
25
+ year,
26
+ earnings: (i === lastYearWorked)
27
+ ? lastWage
28
+ : ((_a = wageResults.find((entry) => entry.year === nextYear)) === null || _a === void 0 ? void 0 : _a.earnings) * getReductionFactor(i) / (1 + earningGrowthRate) / youthAdjustment
29
+ });
23
30
  }
24
31
  // Cap wages at taxable maximum
25
- Object.keys(wageResults).forEach(strYear => {
26
- const year = parseInt(strYear);
27
- const maxTaxable = taxableMaximum[year];
28
- wageResults[year] = Math.min(wageResults[year], maxTaxable);
32
+ wageResults.forEach(({ year, earnings }) => {
33
+ const maxTaxable = taxableMaximum.find((entry) => entry.year === year).earnings;
34
+ const currentEarnings = wageResults.find((entry) => entry.year === year).earnings;
35
+ const maxEarnings = Math.min(currentEarnings, maxTaxable);
36
+ wageResults.find((entry) => entry.year === year).earnings = maxEarnings;
29
37
  });
30
38
  return wageResults;
31
39
  }
32
40
  function getReductionFactor(year) {
33
- const allIndexes = Object.assign(Object.assign({}, wageIndex), quickCalcProjections);
41
+ const allIndexes = wageIndex.concat(wageIndexFuture);
34
42
  const lastYear = year - 1;
35
43
  const nextYear = year + 1;
36
- if (year === CURRENT_YEAR && !allIndexes[lastYear]) {
44
+ if (year === CURRENT_YEAR && !allIndexes.find((entry) => entry.year === lastYear)) {
37
45
  throw new Error(`Wage index for previous year (${lastYear}) is required`);
38
46
  }
39
47
  if (year === CURRENT_YEAR) {
40
48
  return 1;
41
49
  }
42
50
  else {
43
- return (allIndexes[year] / allIndexes[nextYear]);
51
+ return ((allIndexes.find((entry) => entry.year === year).earnings) / (allIndexes.find((entry) => entry.year === nextYear).earnings));
44
52
  }
45
53
  }
package/lib/index.d.ts CHANGED
@@ -2,15 +2,11 @@ import { Wages } from './model';
2
2
  export declare function calc(birthday: Date, retirementDate: Date, earnings: Wages): {
3
3
  AIME: number;
4
4
  NormalMonthlyBenefit: number;
5
- NormalAnnualBenefit: number;
6
- ReducedMonthlyBenefit: number;
7
- ReducedAnnualBenefit: number;
8
5
  };
9
6
  export declare function calcRetirementBenefit(birthday: Date, retirementDate: Date, AIME: number): {
10
7
  AIME: number;
11
8
  NormalMonthlyBenefit: number;
12
- NormalAnnualBenefit: number;
13
- ReducedMonthlyBenefit: number;
14
- ReducedAnnualBenefit: number;
15
9
  };
10
+ export declare function calculatePIA(AIME: number, baseYear?: number): number;
11
+ export declare function calculateAIME(earnings: Wages, baseYear?: number): number;
16
12
  export declare function getFullRetirementMonths(commonLawBirthDate: Date): number;
package/lib/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { wageIndex } from './wage-index';
2
+ const EARLY_RETIREMENT_AGE = 62;
2
3
  export function calc(birthday, retirementDate, earnings) {
3
4
  const AIME = calculateAIME(earnings);
4
5
  const results = calcRetirementBenefit(birthday, retirementDate, AIME);
@@ -6,22 +7,37 @@ export function calc(birthday, retirementDate, earnings) {
6
7
  }
7
8
  export function calcRetirementBenefit(birthday, retirementDate, AIME) {
8
9
  const eclBirthDate = getEnglishCommonLawDate(birthday);
9
- const fullRetirementMonths = getFullRetirementMonths(eclBirthDate);
10
- const PIA = calculatePIA(AIME);
11
- const benefitAt62 = calculateSocialSecurityReduction(PIA, 60);
12
- const normalMonthlyBenefit = Math.floor(PIA);
10
+ const fraMonths = getFullRetirementMonths(eclBirthDate);
11
+ const fullRetirementDate = new Date(eclBirthDate.getFullYear(), eclBirthDate.getMonth() + fraMonths, eclBirthDate.getDate());
12
+ const earliestRetirementDate = new Date(eclBirthDate.getFullYear() + EARLY_RETIREMENT_AGE, eclBirthDate.getMonth(), eclBirthDate.getDate());
13
+ const age60Year = eclBirthDate.getFullYear() + 60;
14
+ const PIA = calculatePIA(AIME, age60Year);
15
+ const earlyRetireMonths = monthsDifference(retirementDate, fullRetirementDate);
16
+ let adjustedBenefits = PIA;
17
+ if (retirementDate < earliestRetirementDate) {
18
+ adjustedBenefits = 0;
19
+ }
20
+ else if (earlyRetireMonths < 0) {
21
+ adjustedBenefits = calculateSocialSecurityReduction(PIA, earlyRetireMonths * -1);
22
+ }
23
+ else if (earlyRetireMonths > 0) {
24
+ adjustedBenefits = calculateSocialSecurityIncrease(eclBirthDate, PIA, earlyRetireMonths);
25
+ }
26
+ const monthlyBenefit = Math.floor(adjustedBenefits);
13
27
  const results = {
14
28
  "AIME": AIME,
15
- "NormalMonthlyBenefit": normalMonthlyBenefit,
16
- "NormalAnnualBenefit": PIA * 12,
17
- "ReducedMonthlyBenefit": benefitAt62,
18
- "ReducedAnnualBenefit": benefitAt62 * 12,
29
+ "NormalMonthlyBenefit": monthlyBenefit,
19
30
  };
20
31
  return results;
21
32
  }
22
- function calculatePIA(AIME) {
23
- const averageWageLastYear = Math.max(...Object.keys(wageIndex).map(val => parseInt(val)));
24
- const wageIndexLastYear = wageIndex[averageWageLastYear];
33
+ export function calculatePIA(AIME, baseYear) {
34
+ var _a;
35
+ const mostRecentWageIndex = Math.max(...wageIndex.map(val => val.year));
36
+ if (baseYear) {
37
+ baseYear = Math.min(baseYear, mostRecentWageIndex);
38
+ }
39
+ const averageWageLastYear = baseYear || mostRecentWageIndex;
40
+ const wageIndexLastYear = ((_a = wageIndex.find(val => val.year === averageWageLastYear)) === null || _a === void 0 ? void 0 : _a.earnings) || 0;
25
41
  const bendPointDivisor = 9779.44;
26
42
  const firstBendPointMultiplier = 180;
27
43
  const secondBendPointMultiplier = 1085;
@@ -48,16 +64,23 @@ function calculatePIA(AIME) {
48
64
  })();
49
65
  return PIA;
50
66
  }
51
- function calculateAIME(earnings) {
67
+ export function calculateAIME(earnings, baseYear) {
68
+ var _a;
52
69
  const lookbackYears = 35;
53
- const averageWageLastYear = Math.max(...Object.keys(wageIndex).map(val => parseInt(val)));
54
- const wageIndexLastYear = wageIndex[averageWageLastYear];
70
+ const mostRecentWageIndex = Math.max(...wageIndex.map(wag => wag.year));
71
+ if (baseYear) {
72
+ baseYear = Math.min(baseYear, mostRecentWageIndex);
73
+ }
74
+ const averageWageLastYear = baseYear || mostRecentWageIndex;
75
+ const wageIndexLastYear = ((_a = wageIndex.find(val => val.year === averageWageLastYear)) === null || _a === void 0 ? void 0 : _a.earnings) || 0;
55
76
  const futureYearsFactor = 1;
56
77
  // calculate the wage index factors
57
- const wageIndexFactors = Object.entries(wageIndex).reduce((acc, [i, val]) => ((acc[parseInt(i)] = 1 + (wageIndexLastYear - val) / val), acc), {});
58
- // adjust the earnings according to the wage index factor,
59
- // factor is 1 for any earnings record without a wage-factor
60
- const adjustedEarnings = Object.entries(earnings).reduce((acc, [i, val]) => ((acc[parseInt(i)] = val * (wageIndexFactors[parseInt(i)] || futureYearsFactor)), acc), {});
78
+ const wageIndexFactors = wageIndex.reduce((acc, { year, earnings }) => (acc[year] = 1 + (Math.max(0, wageIndexLastYear - earnings)) / earnings, acc), {});
79
+ // adjust the earnings according to the wage index factor
80
+ const adjustedEarnings = earnings.reduce((acc, { year, earnings }) => {
81
+ acc[year] = earnings * (wageIndexFactors[year] || futureYearsFactor);
82
+ return acc;
83
+ }, {});
61
84
  const top35YearsEarningsArr = Object.values(adjustedEarnings)
62
85
  .sort((a, b) => b - a) // sort the earnings from highest to lowest amount
63
86
  .slice(0, lookbackYears); // grab the highest 35 earnings years
@@ -80,6 +103,38 @@ function calculateSocialSecurityReduction(amount, months) {
80
103
  }
81
104
  return amount - amount * reduction;
82
105
  }
106
+ function calculateSocialSecurityIncrease(birthday, initialAmount, numberOfMonths) {
107
+ const birthYear = birthday.getFullYear();
108
+ let monthlyRate;
109
+ // Determine the monthly rate based on the year of birth
110
+ if (birthYear < 1933) {
111
+ throw new Error(`Invalid birth year for delayed retirement: ${birthYear}`);
112
+ }
113
+ else if (birthYear <= 1934) {
114
+ monthlyRate = 11 / 24 / 100; // 11/24 of 1%
115
+ }
116
+ else if (birthYear <= 1936) {
117
+ monthlyRate = 0.005; // 1/2 of 1%
118
+ }
119
+ else if (birthYear <= 1938) {
120
+ monthlyRate = 13 / 24 / 100; // 13/24 of 1%
121
+ }
122
+ else if (birthYear <= 1940) {
123
+ monthlyRate = 7 / 12 / 100; // 7/12 of 1%
124
+ }
125
+ else if (birthYear <= 1942) {
126
+ monthlyRate = 5 / 8 / 100; // 5/8 of 1%
127
+ }
128
+ else {
129
+ monthlyRate = 2 / 3 / 100; // 2/3 of 1%
130
+ }
131
+ // Calculate the new amount
132
+ let totalAdjustment = 0;
133
+ for (let i = 0; i < numberOfMonths; i++) {
134
+ totalAdjustment += monthlyRate;
135
+ }
136
+ return initialAmount * (1 + totalAdjustment);
137
+ }
83
138
  function roundToFloorTenCents(amount) {
84
139
  // Convert the amount to fractional dimes
85
140
  let dimes = amount * 10;
@@ -109,12 +164,10 @@ export function getFullRetirementMonths(commonLawBirthDate) {
109
164
  throw new Error('Invalid birth year');
110
165
  }
111
166
  }
112
- /*
113
- 1943-1954 66 48 $750 25.00% $350 30.00%
114
- 1955 66 and 2 months 50 $741 25.83% $345 30.83%
115
- 1956 66 and 4 months 52 $733 26.67% $341 31.67%
116
- 1957 66 and 6 months 54 $725 27.50% $337 32.50%
117
- 1958 66 and 8 months 56 $716 28.33% $333 33.33%
118
- 1959 66 and 10 months 58 $708 29.17% $329 34.17%
119
- 1960+ 67 60 $700 30.00% $325 35.00%
120
- */
167
+ function monthsDifference(date1, date2) {
168
+ // Calculate the total number of months for each date
169
+ const months1 = date1.getFullYear() * 12 + date1.getMonth();
170
+ const months2 = date2.getFullYear() * 12 + date2.getMonth();
171
+ // Return the difference in months
172
+ return months1 - months2;
173
+ }
package/lib/model.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare type YearRange = 1951 | 1952 | 1953 | 1954 | 1955 | 1956 | 1957 | 1958 | 1959 | 1960 | 1961 | 1962 | 1963 | 1964 | 1965 | 1966 | 1967 | 1968 | 1969 | 1970 | 1971 | 1972 | 1973 | 1974 | 1975 | 1976 | 1977 | 1978 | 1979 | 1980 | 1981 | 1982 | 1983 | 1984 | 1985 | 1986 | 1987 | 1988 | 1989 | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | 1999 | 2000 | 2001 | 2002 | 2003 | 2004 | 2005 | 2006 | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024;
2
- export declare type Wages = {
3
- [K in YearRange]?: number;
4
- };
1
+ export type Wages = {
2
+ year: number;
3
+ earnings: number;
4
+ }[];
@@ -13,7 +13,7 @@ async function getWages(fileName) {
13
13
  throw `${schema} is not supported (${supportedVersion})`;
14
14
  }
15
15
  const results = result[`${NS}:ONLINESOCIALSECURITYSTATEMENTDATA`][`${NS}:EARNINGSRECORD`][0][`${NS}:EARNINGS`];
16
- const earnings = results.reduce((acc, earn) => (earn[`${NS}:FICAEARNINGS`][0] === '-1' ? acc : acc[earn['$'].STARTYEAR] = parseInt(earn[`${NS}:FICAEARNINGS`][0]), acc), {});
16
+ const earnings = results.reduce((acc, earn) => (earn[`${NS}:FICAEARNINGS`][0] === '-1' ? acc : acc.push({ year: [earn['$'].STARTYEAR], earnings: parseInt(earn[`${NS}:FICAEARNINGS`][0]) }), acc), []);
17
17
  return earnings;
18
18
  }
19
19
  export default getWages;
@@ -1,32 +1,4 @@
1
1
  import { Wages } from './model';
2
2
  export declare const wageIndex: Wages;
3
- export declare const quickCalcProjections: {
4
- 2023: number;
5
- 2024: number;
6
- 2025: number;
7
- 2026: number;
8
- 2027: number;
9
- 2028: number;
10
- 2029: number;
11
- 2030: number;
12
- 2031: number;
13
- 2032: number;
14
- 2033: number;
15
- 2034: number;
16
- 2035: number;
17
- 2036: number;
18
- 2037: number;
19
- 2038: number;
20
- 2039: number;
21
- 2040: number;
22
- 2041: number;
23
- 2042: number;
24
- 2043: number;
25
- 2044: number;
26
- 2045: number;
27
- 2046: number;
28
- 2047: number;
29
- 2048: number;
30
- 2049: number;
31
- };
3
+ export declare const wageIndexFuture: Wages;
32
4
  export declare const taxableMaximum: Wages;
package/lib/wage-index.js CHANGED
@@ -1,160 +1,160 @@
1
1
  // https://www.ssa.gov/OACT/COLA/awiseries.html
2
- export const wageIndex = {
3
- 1951: 2799.16,
4
- 1952: 2973.32,
5
- 1953: 3139.44,
6
- 1954: 3155.64,
7
- 1955: 3301.44,
8
- 1956: 3532.36,
9
- 1957: 3641.72,
10
- 1958: 3673.8,
11
- 1959: 3855.8,
12
- 1960: 4007.12,
13
- 1961: 4086.76,
14
- 1962: 4291.4,
15
- 1963: 4396.64,
16
- 1964: 4576.32,
17
- 1965: 4658.72,
18
- 1966: 4938.36,
19
- 1967: 5213.44,
20
- 1968: 5571.76,
21
- 1969: 5893.76,
22
- 1970: 6186.24,
23
- 1971: 6497.08,
24
- 1972: 7133.8,
25
- 1973: 7580.16,
26
- 1974: 8030.76,
27
- 1975: 8630.92,
28
- 1976: 9226.48,
29
- 1977: 9779.44,
30
- 1978: 10556.03,
31
- 1979: 11479.46,
32
- 1980: 12513.46,
33
- 1981: 13773.1,
34
- 1982: 14531.34,
35
- 1983: 15239.24,
36
- 1984: 16135.07,
37
- 1985: 16822.51,
38
- 1986: 17321.82,
39
- 1987: 18426.51,
40
- 1988: 19334.04,
41
- 1989: 20099.55,
42
- 1990: 21027.98,
43
- 1991: 21811.6,
44
- 1992: 22935.42,
45
- 1993: 23132.67,
46
- 1994: 23753.53,
47
- 1995: 24705.66,
48
- 1996: 25913.9,
49
- 1997: 27426.0,
50
- 1998: 28861.44,
51
- 1999: 30469.84,
52
- 2000: 32154.82,
53
- 2001: 32921.92,
54
- 2002: 33252.09,
55
- 2003: 34064.95,
56
- 2004: 35648.55,
57
- 2005: 36952.94,
58
- 2006: 38651.41,
59
- 2007: 40405.48,
60
- 2008: 41334.97,
61
- 2009: 40711.61,
62
- 2010: 41673.83,
63
- 2011: 42979.61,
64
- 2012: 44321.67,
65
- 2013: 44888.16,
66
- 2014: 46481.52,
67
- 2015: 48098.63,
68
- 2016: 48642.15,
69
- 2017: 50321.89,
70
- 2018: 52145.8,
71
- 2019: 54099.99,
72
- 2020: 55628.6,
73
- 2021: 60575.07,
74
- 2022: 63795.13
75
- };
76
- // retrieved from: view-source:https://www.ssa.gov/cgi-bin/benefit6.cgi
77
- export const quickCalcProjections = {
78
- 2023: 66488.13,
79
- 2024: 68981.33,
80
- 2025: 71780.09,
81
- 2026: 74731.71,
82
- 2027: 77792.60,
83
- 2028: 80925.73,
84
- 2029: 84188.76,
85
- 2030: 87555.49,
86
- 2031: 91041.35,
87
- 2032: 94479.84,
88
- 2033: 97957.36,
89
- 2034: 101547.32,
90
- 2035: 105266.09,
91
- 2036: 109120.74,
92
- 2037: 113117.42,
93
- 2038: 117250.70,
94
- 2039: 121537.41,
95
- 2040: 125958.59,
96
- 2041: 130512.20,
97
- 2042: 135207.00,
98
- 2043: 140051.90,
99
- 2044: 145045.39,
100
- 2045: 150193.68,
101
- 2046: 155501.36,
102
- 2047: 160999.09,
103
- 2048: 166686.37,
104
- 2049: 172576.11,
105
- };
106
- export const taxableMaximum = {
107
- 1972: 9000,
108
- 1973: 10800,
109
- 1974: 13200,
110
- 1975: 14100,
111
- 1976: 15300,
112
- 1977: 16500,
113
- 1978: 17700,
114
- 1979: 22900,
115
- 1980: 25900,
116
- 1981: 29700,
117
- 1982: 32400,
118
- 1983: 35700,
119
- 1984: 37800,
120
- 1985: 39600,
121
- 1986: 42000,
122
- 1987: 43800,
123
- 1988: 45000,
124
- 1989: 48000,
125
- 1990: 51300,
126
- 1991: 53400,
127
- 1992: 55500,
128
- 1993: 57600,
129
- 1994: 60600,
130
- 1995: 61200,
131
- 1996: 62700,
132
- 1997: 65400,
133
- 1998: 68400,
134
- 1999: 72600,
135
- 2000: 76200,
136
- 2001: 80400,
137
- 2002: 84900,
138
- 2003: 87000,
139
- 2004: 87900,
140
- 2005: 90000,
141
- 2006: 94200,
142
- 2007: 97500,
143
- 2008: 102000,
144
- 2009: 106800,
145
- 2010: 106800,
146
- 2011: 106800,
147
- 2012: 110100,
148
- 2013: 113700,
149
- 2014: 117000,
150
- 2015: 118500,
151
- 2016: 118500,
152
- 2017: 127200,
153
- 2018: 128400,
154
- 2019: 132900,
155
- 2020: 137700,
156
- 2021: 142800,
157
- 2022: 147000,
158
- 2023: 160200,
159
- 2024: 168600,
160
- };
2
+ export const wageIndex = [
3
+ { year: 1951, earnings: 2799.16 },
4
+ { year: 1952, earnings: 2973.32 },
5
+ { year: 1953, earnings: 3139.44 },
6
+ { year: 1954, earnings: 3155.64 },
7
+ { year: 1955, earnings: 3301.44 },
8
+ { year: 1956, earnings: 3532.36 },
9
+ { year: 1957, earnings: 3641.72 },
10
+ { year: 1958, earnings: 3673.8 },
11
+ { year: 1959, earnings: 3855.8 },
12
+ { year: 1960, earnings: 4007.12 },
13
+ { year: 1961, earnings: 4086.76 },
14
+ { year: 1962, earnings: 4291.4 },
15
+ { year: 1963, earnings: 4396.64 },
16
+ { year: 1964, earnings: 4576.32 },
17
+ { year: 1965, earnings: 4658.72 },
18
+ { year: 1966, earnings: 4938.36 },
19
+ { year: 1967, earnings: 5213.44 },
20
+ { year: 1968, earnings: 5571.76 },
21
+ { year: 1969, earnings: 5893.76 },
22
+ { year: 1970, earnings: 6186.24 },
23
+ { year: 1971, earnings: 6497.08 },
24
+ { year: 1972, earnings: 7133.8 },
25
+ { year: 1973, earnings: 7580.16 },
26
+ { year: 1974, earnings: 8030.76 },
27
+ { year: 1975, earnings: 8630.92 },
28
+ { year: 1976, earnings: 9226.48 },
29
+ { year: 1977, earnings: 9779.44 },
30
+ { year: 1978, earnings: 10556.03 },
31
+ { year: 1979, earnings: 11479.46 },
32
+ { year: 1980, earnings: 12513.46 },
33
+ { year: 1981, earnings: 13773.1 },
34
+ { year: 1982, earnings: 14531.34 },
35
+ { year: 1983, earnings: 15239.24 },
36
+ { year: 1984, earnings: 16135.07 },
37
+ { year: 1985, earnings: 16822.51 },
38
+ { year: 1986, earnings: 17321.82 },
39
+ { year: 1987, earnings: 18426.51 },
40
+ { year: 1988, earnings: 19334.04 },
41
+ { year: 1989, earnings: 20099.55 },
42
+ { year: 1990, earnings: 21027.98 },
43
+ { year: 1991, earnings: 21811.6 },
44
+ { year: 1992, earnings: 22935.42 },
45
+ { year: 1993, earnings: 23132.67 },
46
+ { year: 1994, earnings: 23753.53 },
47
+ { year: 1995, earnings: 24705.66 },
48
+ { year: 1996, earnings: 25913.9 },
49
+ { year: 1997, earnings: 27426.0 },
50
+ { year: 1998, earnings: 28861.44 },
51
+ { year: 1999, earnings: 30469.84 },
52
+ { year: 2000, earnings: 32154.82 },
53
+ { year: 2001, earnings: 32921.92 },
54
+ { year: 2002, earnings: 33252.09 },
55
+ { year: 2003, earnings: 34064.95 },
56
+ { year: 2004, earnings: 35648.55 },
57
+ { year: 2005, earnings: 36952.94 },
58
+ { year: 2006, earnings: 38651.41 },
59
+ { year: 2007, earnings: 40405.48 },
60
+ { year: 2008, earnings: 41334.97 },
61
+ { year: 2009, earnings: 40711.61 },
62
+ { year: 2010, earnings: 41673.83 },
63
+ { year: 2011, earnings: 42979.61 },
64
+ { year: 2012, earnings: 44321.67 },
65
+ { year: 2013, earnings: 44888.16 },
66
+ { year: 2014, earnings: 46481.52 },
67
+ { year: 2015, earnings: 48098.63 },
68
+ { year: 2016, earnings: 48642.15 },
69
+ { year: 2017, earnings: 50321.89 },
70
+ { year: 2018, earnings: 52145.8 },
71
+ { year: 2019, earnings: 54099.99 },
72
+ { year: 2020, earnings: 55628.6 },
73
+ { year: 2021, earnings: 60575.07 },
74
+ { year: 2022, earnings: 63795.13 },
75
+ { year: 2023, earnings: 66621.80 },
76
+ ];
77
+ export const wageIndexFuture = [
78
+ { year: 2024, earnings: 69472.44 },
79
+ { year: 2025, earnings: 72255.52 },
80
+ { year: 2026, earnings: 75264.81 },
81
+ { year: 2027, earnings: 78304.32 },
82
+ { year: 2028, earnings: 81522.64 },
83
+ { year: 2029, earnings: 84736.18 },
84
+ { year: 2030, earnings: 88030.45 },
85
+ { year: 2031, earnings: 91479.46 },
86
+ { year: 2032, earnings: 95090.94 },
87
+ { year: 2033, earnings: 98856.61 },
88
+ { year: 2034, earnings: 102670.10 },
89
+ { year: 2035, earnings: 106494.41 },
90
+ { year: 2036, earnings: 110382.54 },
91
+ { year: 2037, earnings: 114421.90 },
92
+ { year: 2038, earnings: 118616.20 },
93
+ { year: 2039, earnings: 122981.73 },
94
+ { year: 2040, earnings: 127479.70 },
95
+ { year: 2041, earnings: 132110.84 },
96
+ { year: 2042, earnings: 136899.00 },
97
+ { year: 2043, earnings: 141834.11 },
98
+ { year: 2044, earnings: 146908.25 },
99
+ { year: 2045, earnings: 152129.95 },
100
+ { year: 2046, earnings: 157512.41 },
101
+ { year: 2047, earnings: 163082.20 },
102
+ { year: 2048, earnings: 168837.13 },
103
+ { year: 2049, earnings: 174786.94 }
104
+ ];
105
+ export const taxableMaximum = [
106
+ { year: 1972, earnings: 9000 },
107
+ { year: 1973, earnings: 10800 },
108
+ { year: 1974, earnings: 13200 },
109
+ { year: 1975, earnings: 14100 },
110
+ { year: 1976, earnings: 15300 },
111
+ { year: 1977, earnings: 16500 },
112
+ { year: 1978, earnings: 17700 },
113
+ { year: 1979, earnings: 22900 },
114
+ { year: 1980, earnings: 25900 },
115
+ { year: 1981, earnings: 29700 },
116
+ { year: 1982, earnings: 32400 },
117
+ { year: 1983, earnings: 35700 },
118
+ { year: 1984, earnings: 37800 },
119
+ { year: 1985, earnings: 39600 },
120
+ { year: 1986, earnings: 42000 },
121
+ { year: 1987, earnings: 43800 },
122
+ { year: 1988, earnings: 45000 },
123
+ { year: 1989, earnings: 48000 },
124
+ { year: 1990, earnings: 51300 },
125
+ { year: 1991, earnings: 53400 },
126
+ { year: 1992, earnings: 55500 },
127
+ { year: 1993, earnings: 57600 },
128
+ { year: 1994, earnings: 60600 },
129
+ { year: 1995, earnings: 61200 },
130
+ { year: 1996, earnings: 62700 },
131
+ { year: 1997, earnings: 65400 },
132
+ { year: 1998, earnings: 68400 },
133
+ { year: 1999, earnings: 72600 },
134
+ { year: 2000, earnings: 76200 },
135
+ { year: 2001, earnings: 80400 },
136
+ { year: 2002, earnings: 84900 },
137
+ { year: 2003, earnings: 87000 },
138
+ { year: 2004, earnings: 87900 },
139
+ { year: 2005, earnings: 90000 },
140
+ { year: 2006, earnings: 94200 },
141
+ { year: 2007, earnings: 97500 },
142
+ { year: 2008, earnings: 102000 },
143
+ { year: 2009, earnings: 106800 },
144
+ { year: 2010, earnings: 106800 },
145
+ { year: 2011, earnings: 106800 },
146
+ { year: 2012, earnings: 110100 },
147
+ { year: 2013, earnings: 113700 },
148
+ { year: 2014, earnings: 117000 },
149
+ { year: 2015, earnings: 118500 },
150
+ { year: 2016, earnings: 118500 },
151
+ { year: 2017, earnings: 127200 },
152
+ { year: 2018, earnings: 128400 },
153
+ { year: 2019, earnings: 132900 },
154
+ { year: 2020, earnings: 137700 },
155
+ { year: 2021, earnings: 142800 },
156
+ { year: 2022, earnings: 147000 },
157
+ { year: 2023, earnings: 160200 },
158
+ { year: 2024, earnings: 168600 },
159
+ { year: 2025, earnings: 176100 },
160
+ ];
package/package.json CHANGED
@@ -1,26 +1,24 @@
1
1
  {
2
2
  "name": "social-security-calculator",
3
- "version": "0.0.11",
3
+ "version": "0.1.2",
4
4
  "description": "Calculate estimated Social Security Benefits",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "type": "module",
8
8
  "exports": {
9
9
  ".": "./lib/index.js",
10
- "./parseStatement": {
11
- "import": "./lib/parseStatement/index.js",
12
- "types": "./lib/parseStatement/index.d.ts"
13
- },
14
- "./estimatedEarnings": {
15
- "import": "./lib/estimatedEarnings/index.js",
16
- "types": "./lib/estimatedEarnings/index.d.ts"
10
+ "./estimatedEarnings": "./lib/estimatedEarnings/index.js"
11
+ },
12
+ "typesVersions": {
13
+ "*": {
14
+ "estimatedEarnings": [
15
+ "./lib/estimatedEarnings"
16
+ ]
17
17
  }
18
18
  },
19
- "files": [
20
- "lib"
21
- ],
22
19
  "scripts": {
23
20
  "test": "NODE_OPTIONS='--experimental-vm-modules' jest",
21
+ "test:scrape": "node tools/getTestData.js",
24
22
  "build": "tsc"
25
23
  },
26
24
  "repository": {
@@ -44,7 +42,9 @@
44
42
  "@types/jest": "^29.5.8",
45
43
  "@types/xml2js": "^0.4.11",
46
44
  "compound-calc": "^4.0.3",
45
+ "csvtojson": "^2.0.10",
47
46
  "jest": "^29.7.0",
47
+ "playwright": "^1.54.1",
48
48
  "ts-jest": "^29.1.1",
49
49
  "typescript": "^4.8.3"
50
50
  },