]> git.scottworley.com Git - inverse-tax/blobdiff - tax_ui.js
load_tax_table: Optional deductible
[inverse-tax] / tax_ui.js
index 57bd361b941a442131ed3777c941ef0909b21ff8..0117dcc19df4ae62c77bc4265aa5e0c00644e538 100644 (file)
--- a/tax_ui.js
+++ b/tax_ui.js
@@ -1,8 +1,8 @@
 "use strict";
 
-function load_tax_table(table_id, deductible_id) {
-  return apply_deductible(parse_tax_table(document.getElementById(table_id).value),
-                          parseFloat(document.getElementById(deductible_id).value));
+function load_tax_table(table_id, deductible_id = null) {
+  const deductible = deductible_id == null ? 0.0 : parseFloat(document.getElementById(deductible_id).value);
+  return apply_deductible(parse_tax_table(document.getElementById(table_id).value), deductible);
 }
 
 function format_number(n) {