taxsim.js demo



  1. place both files on a webserver
  2. include taxsim.js from an html page
  3. invoke the taxsim() javascript function
  4. resolve the returned Promise to retrieve the output
<script src="taxsim.js"></script>
  // taxsim.js implements a function with the following prototype:
  //    function taxsim(input: String): Promise
  //    function taxsim(input: Object): Promise
  // the returned promise can be manipulated either directly or via async/await

  // sample input
  let input1 = ["taxsimid,mstat,year,ltcg,idtl", "1,2,1970,100000,5"].join("\n")
  let input2 = {taxsimid: 1, mstat: 2, year: 1970, ltcg: 100000, idtl: 5}

  // promise api
  taxsim(input1).then(function(output) {
    console.log('taxsim output', output)
  }).catch(function(error) {
    console.log('taxsim failed', error)

  // async/await api
  try {
    let output = await taxsim(input2)
    console.log('taxsim output', output)
  } catch(error) {
    console.log('taxsim failed', error)

load file

load a CSV file for local processing

interactive example

the output in the example below is calculated right here in your browser, using taxsim.js

the input is interactive, so you can modify the text and the output will recompute