Huffman data compression in javascript