1.0.1 • Published 1 year ago

us-taxes v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

us-taxes

npm package Build Status Downloads Issues Code Coverage Commitizen Friendly Semantic Release

This package is meant to help calculate US taxes based on a progressive income tax brackets!

Install

npm install us-taxes

Usage

import { calculateTaxAmount, calculateFederalIncomeTax, FilingStatus } from 'us-taxes';

const brackets = [
{ maxAmount: 0, rate: 0 },
{ maxAmount: 10275, rate: 0.1 },
{ maxAmount: 41775, rate: 0.12 },
{ maxAmount: 89075, rate: 0.22 },
{ maxAmount: 170050, rate: 0.24 },
{ maxAmount: 215950, rate: 0.32 },
{ maxAmount: 539900, rate: 0.35 },
{ maxAmount: Infinity, rate: 0.37 },
];


const taxAmount = calculateTaxAmount(500, brackets);
//=> 'taxAmount is the amount of taxes owed based on the income amount passed in'

const federalTaxAmount = calculateFederalIncomeTax({amount: 500});
const federalTaxAmountCustom = calculateFederalIncomeTax({amount: 500, filingStatus: FilingStatus.Single, year: 2022});
//=> 'federalTaxAmount is the amount of taxes owed to the federal government, defaults to a single filing status and current year'
//=> 'federalTaxAmountCustom is the amount of taxes owed to the federal government but setting values for filingStatus and year'

API

calculateTaxAmount(amount, brackets)

amount

Type: number

The amount of taxable income to use when calculating taxes due.

brackets

Type: object

The tax brackets to use when calculating the amount of taxes owed for the taxable income passed in

maxAmount

Type: number

The maxAmount for the tax bracket

rate

Type: number

The tax rate for this tax bracket

calculateFederalIncomeTax({amount: number, filingStatus?: FilingStatus, year?: number})

amount

Type: number

The amount of taxable income to use when calculating taxes due.

filingStatus

Type: FilingStatus default: FilingStatus.Single

The filingStatus to use when calculating taxes for the incoming, defaults to S

year

Type: number default: current year

The year to use when determing the tax brackets