Getting Started
Independent worker (category B) calculations. For payroll simulations, see dependent worker docs.
Installation
npm install saldo
# or
pnpm add saldoQuick Start (CLI)
You can run independent worker calculations directly from the terminal if you install the package globally:
saldo independent --income 30000 --expenses 2000 --benefits-of-youth-irs
# Or for Green Receipts parsing directly:
saldo independent-csv --csv path/to/receipts.csvQuick Start (Library)
Interactive Example
Understanding the Result
interface IndependentWorkerResult {
grossIncome: CurrencyByFrequency; // year/month/day
taxableIncome: number;
ssPay: CurrencyByFrequency; // SS after discounts/caps
specificDeductions: number; // Max of €4104 vs 10% SS
expenses: number; // Declared expenses
expensesNeeded: number; // Missing to reach simplified cap
youthIrsDiscount: number; // IAS-capped youth benefit
irsPay: CurrencyByFrequency; // IRS due (progressive or RNH flat)
netIncome: CurrencyByFrequency;
taxRank: TaxRank; // Progressive bracket used
currentIas: number; // IAS for selected year
maxSsIncome: number; // 12 × IAS cap
ssTax: number;
maxExpensesTax: number; // Simplified regime %
workerWithinFirstFinancialYear: boolean; // 37.5% factor
workerWithinSecondFinancialYear: boolean; // 56.25% factor
workerWithinFirst12Months: boolean; // SS exemption window
rnh: boolean;
rnhTax: number;
benefitsOfYouthIrs: boolean;
yearOfYouthIrs: number;
}Key Parameters
income+incomeFrequency:'year'(default),'month', or'day'(uses year-specific business days). Alternatively, pass an array of 12 numbers (one per calendar month) for variable monthly income — in this caseincomeFrequencyis ignored and SS is calculated using quarterly averages.yearBusinessDays: Optional override for the year business-day baselinenrDaysOff: For daily frequency; must be an integer <yearBusinessDaysssTax: Social security rate (default0.214) andssDiscountrange-0.25..0.25currentTaxRankYear:2023 | 2024 | 2025 | 2026IRS tablesmaxExpensesTax: Simplified regime percentage (default15)expenses: Declared expenses (0 by default)dateOfOpeningActivity: Determines first/second financial year factors and SS exemption in first 12 monthsrnh/rnhTax: Apply RNH flat tax instead of progressive bracketsbenefitsOfYouthIrs+yearOfYouthIrs: Youth IRS discounts with IAS caps (1–10 years depending on tax year)
Common Scenarios
Daily contractor with days off and SS discount
Interactive Example
RNH flat rate vs. progressive IRS
Interactive Example
Opening activity and SS exemption
Interactive Example
Working with Types
import {
simulateIndependentWorker,
FrequencyChoices,
SimulateIndependentWorkerOptions,
IndependentWorkerResult
} from 'saldo';
const independentOpts: SimulateIndependentWorkerOptions = {
income: 35000,
incomeFrequency: FrequencyChoices.Year,
benefitsOfYouthIrs: true,
yearOfYouthIrs: 2,
};
const independentResult: IndependentWorkerResult = simulateIndependentWorker(independentOpts);Error Handling
Interactive Example
Next Steps
Last updated on