]> git.scottworley.com Git - inverse-tax/blobdiff - tax.js
Handle empty tax table
[inverse-tax] / tax.js
diff --git a/tax.js b/tax.js
index 0d94200ce97849d3e97d73e5fce84e44dd98f26d..d26db5fa15f0b8cf0cdd006fd4b19cc4f6e37076 100644 (file)
--- a/tax.js
+++ b/tax.js
@@ -49,6 +49,8 @@ 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: