Code 39 barcode D3.js javascript generation

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.12/d3.min.js"></script>
<div id="barcode"></div>

CSS

svg {
  width: 90px;
  height: 60px;
}

text {
  text-anchor: middle;
  font-family: monospace;
}

path {
  fill-opacity: 0;
}

JavaScript

//code adapted and modified from
//Simplex Noise Code 39 Barcode by Christopher Manning
//http://bl.ocks.org/christophermanning/4324236

//Other example of code 39 barcode
//http://notionovus.com/blog/code-39-barcode-biscuits/

characters = {
  '100100100101': '$',
  '100100101001': '/',
  '100101001001': '+',
  '100101011011': '-',
  '100101101011': 'X',
  '100101101101': '*',
  '100110101011': 'V',
  '100110101101': ' ',
  '100110110101': 'Z',
  '101001001001': '%',
  '101001011011': '7',
  '101001101011': '4',
  '101001101101': '0',
  '101010011011': 'G',
  '101010110011': 'Q',
  '101011001011': 'D',
  '101011001101': 'J',
  '101011010011': 'N',
  '101011011001': 'T',
  '101100101011': '2',
  '101100101101': '9',
  '101100110101': '6',
  '101101001011': 'B',
  '101101001101': 'I',
  '101101010011': 'L',
  '101101011001': 'S',
  '101101100101': 'F',
  '101101101001': 'P',
  '110010101011': 'U',
  '110010101101': '0',
  '110010110101': 'Y',
  '110011010101': 'W',
  '110100101011': '1',
  '110100101101': '8',
  '110100110101': '5',
  '110101001011': 'A',
  '110101001101': 'H',
  '110101010011': 'K',
  '110101011001': 'R',
  '110101100101': 'E',
  '110101101001': 'O',
  '110110010101': '3',
  '110110100101': 'C',
  '110110101001': 'M',
}


//var num= prompt("Enter num")
//console.log(parseInt(num, 10).toString(2))

//var decnum=892938
//alert(decnum.toString(2))
//var b = parseInt( a, 2 )


// var str = '34566'
// var found = str.match(/[01]{12}/g).map(['110100101101','101100101101', '101100101011', '101100101101', '110110010101', '110100101101'])
//str.match(/[01]{12}/g).map(characters)
//console.log(characters[v])
//console.log(found)


//API get/set int
//var str = ['110100101101','101100101101', '101100101011', '101100101101', '110110010101', '110100101101']
//var barcode_array = str.match(/[01]{12}/g).map(Object.keys(characters))

//console.log(barcode_array)

//split into array
var barcode_input = ['110100101101', '101100101101', '101100101011',...