saldo
Version:
Portuguese salary calculator library
25 lines (24 loc) • 706 B
JavaScript
export class LunchAllowance {
dailyValue;
mode;
daysCount;
constructor(dailyValue, mode, daysCount) {
this.dailyValue = dailyValue;
this.mode = mode;
this.daysCount = daysCount;
}
get monthlyValue() {
return this.dailyValue * this.daysCount;
}
get taxableMonthlyValue() {
const maxDailyValue = this.mode === "salary" ? 6 : 10.2;
const freeOfTaxAmount = maxDailyValue * this.daysCount;
return Math.max(0, this.monthlyValue - freeOfTaxAmount);
}
get taxFreeMonthlyValue() {
return this.monthlyValue - this.taxableMonthlyValue;
}
get yearlyValue() {
return this.monthlyValue * 11;
}
}