2 ms·
I once tried to model tax forms as code and one thing I learned is that using observable / computable model (as in mobX / knockout.js) works pretty well for com
by petethepig 6y ago
I once tried to model tax forms as code and one thing I learned is that using observable / computable model (as in mobX / knockout.js) works pretty well for computing tax.
For example:
this.totalDeductions = this.computed(() => {
return this.isItemizing() ? this.itemizedDeductionsAdjusted() : this.standardDeduction();
}).form("f1040-131"); // 131 is reference to a field on the tax form
this.afterDeductions = this.computed(() => {
return this.adjustedGrossIncome() - this.totalDeductions();
}).form("f1040-133")
The other thing I learned is that taxes are ridiculously complex.