]> git.scottworley.com Git - inverse-tax/blobdiff - tax.js
Handle the fully-deductible case
[inverse-tax] / tax.js
diff --git a/tax.js b/tax.js
index 7f32f74717a01386caaa937ead3f1d8443b3f610..d9bd34c15b03849b0440ce574469afc2db8f44f6 100644 (file)
--- a/tax.js
+++ b/tax.js
@@ -53,8 +53,6 @@ function merge_tax_tables(t1, t2) {
 }
 
 function invert(table) {
-  if (table.length == 0) return x => x;
-
   // Here we solve
   //   net = m * gross + b
   // for gross:
@@ -90,5 +88,6 @@ function invert(table) {
         return (net - b) / m;
       }
     }
+    return net;
   };
 }