npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pslf-calculations

v1.0.1

Published

PSLF calculations for the student loan forgiveness program

Downloads

4

Readme

PSLF Calculations

This package contains functions that support the calculation of payment plans and repayment plans for the Public Student Loan Forgiveness program.

Functions

Create PSLF Calculator:

// Represents user metadata
type UserInformation = {
    // If married then true, else false
    isMarried: boolean;
    // Adjusted gross income from LAST year
    lastYearAgi: number;
    // Adjusted gross income for THIS year
    thisYearAgi: number;
    // Expected Adjusted gross income for NEXT year
    nextYearAgi: number;
    // If married, spouse's adjusted gross income for LAST year, else 0
    spouseAgi: number;
    // If married, total value of spouse loans
    spouseLoans: number;
    // If married, average interest rate of spouse loans
    spouseLoanInterestRate: number;
};

// Represents loan information for the user
type LoanInformation = {
    // Type of loan - i.e. subsidized / unsubsidized
    type: string;
    // Principal value of loan
    principal: number;
    // Amount of interest that has accrued on loan
    accruedInterest: number;
    // Interest rate of loan
    interest: number;
    // Current total value of loan
    totalLoanBalance: number;
};

// Represents a forward looking income plan
type IncomePlanInformation = {
    // Number that represents the year for that income plan
    year: number;
    // Number that represents user family size. Minimum is 1.
    familySize: number;
    // Number that represents the expected adjusted gross income for that year
    agi: number;
    // If married, number that represents spouse's expected gross income for that year, else 0.
    spouseAgi: number;
};

// Represents the users tax filing status. If married and filing jointly, then set to jointly, otherwise use seperately.
enum FilingStatus {
    jointly: 'jointly',
    separately: 'seperately'
}

// Example User Information Object
const userInformation: UserInformation = {
    isMarried: true,
    lastYearAgi: 43000,
    thisYearAgi: 48000,
    nextYearAgi: 100000,
    spouseAgi: 82000,
    spouseLoans: 22000,
    spouseLoanInterestRate: 2.25
};

// Example Loan Information Array
const loanInformation: LoanInformation[] = [
    {
        type: 'Subsidized',
        principal: 18000,
        accruedInterest: 4500,
        interest: 4.1,
        totalLoanBalance: 22500
    },
    {
        type: 'Subsidized',
        principal: 4000,
        accruedInterest: 325,
        interest: 4.1,
        totalLoanBalance: 4325
    }
];

// Example Income Plan Array
const incomePlan: IncomePlanInformation[] = [
    {
        year: 2020,
        familySize: 2,
        agi: 43000,
        spouseAgi: 82000
    },
    {
        year: 2021,
        familySize: 2,
        agi: 48000,
        spouseAgi: 85000
    },
    {
        year: 2022,
        familySize: 3, // user had a child
        agi: 100000,
        spouseAgi: 87000
    },
    ... // array must have at least 25 years of data
];

// Instantiating PSLFCalculator
const pslfCalculator = new PSLFCalculator(
    userInformation, 
    loanInformation,
    incomePlan, 
    filingStatus
);

Payment Plans:

// Returns an array of numbers representing payments for each of the payment plans
// i.e. [1000, 1100, 1200, ...] 

// Get Standard Payment Plan - returns an array of 10 payments
const standardPaymentPlan = pslfCalculator.standardPaymentPlan();

// Get REFI Payment Plan - returns an array of 20 payments
const refiPaymentPlan = pslfCalculator.refiPaymentPlan();

// Get PAYE Payment Plan - returns an array of 25 payments
const payePaymentPlan = pslfCalculator.payePaymentPlan();

// Get REPAYE Payment Plan - returns an array of 25 payments
const repayePaymentPlan = pslfCalculator.repayePaymentPlan();

// Get IBR Payment Plan - returns an array of 25 payments
const ibrPaymentPlan = pslfCalculator.ibrPaymentPlan();

// Get ICR Payment Plan - returns an array of 25 payments
const icrPaymentPlan = pslfCalculator.icrPaymentPlan();

Repayment Schedules:

// Returns an array of arrays of numbers representing required monthly payments for each of the payment plans. Each array represents a year, and contains the 12 monthly payments that need to be made throughout the year. The first value in each sub-array represents the January payment.
/* 
    [
        [1000, 1100, 1200, ... (contains 12 payments)],
        [1000, 1100, 1200, ... (contains 12 payments)],
        [1000, 1100, 1200, ... (contains 12 payments)],
        ...
    ]
*/

// Get Standard Repayment Schedule - returns repayment plan for 10 years
const standardRepaymentSchedule = pslfCalculator.standardRepaymentSchedule();

// Get REFI Repayment Schedule - returns repayment plan for 20 years
const refiRepaymentSchedule = pslfCalculator.refiRepaymentSchedule();

// Get PAYE Repayment Schedule - returns repayment plan for 20 years
const payeRepaymentSchedule = pslfCalculator.payeRepaymentSchedule();

// Get REPAYE Repayment Schedule - returns repayment plan for 25 years
const repayeRepaymentSchedule = pslfCalculator.repayeRepaymentSchedule();

// Get IBR Repayment Schedule - returns repayment plan for 25 years
const ibrRepaymentSchedule = pslfCalculator.ibrRepaymentSchedule();

// Get ICR Repayment Schedule - returns repayment plan for 25 years
const icrRepaymentSchedule = pslfCalculator.icrRepaymentSchedule();