Converts string-format arbitrary-size integers between different bases in JavaScript