function xToBase10(number, charset) {
  if (typeof charset != 'string' || charset.length < 2)
    throw Error('Invalid charset for base conversion: '+charset)
  let base10 = 0
  for (let i=0; i<number.length; i++) {
    base10 += charset.indexOf(number[number.length-1 - i]) * Math.pow(charset.length, i)
  }
  return base10
}
/**
 * Convert base X (as in any base) to base 10 (our number system).
 * @param {string} number Base X as a string using the supplied charset.
 * @param {string} charset The charset used by this base. E.g. "01" for base 2 (binary) or "0123456789ABCDEF" for base 16 (hex).
 * @returns {number} The number as base 10.
 */
Convert base X (as in any base) to base 10 (our number system).
@param {string} number Base X as a string using the supplied charset.
@param {string} charset The charset used by this base.
Convert base X ( as in any base ) to base 10 ( our number system ) . @param { string } number Base X as a string using the supplied charset . @param { string } charset The charset used by this base .
function xToBase10(number, charset) {
  if (typeof charset != 'string' || charset.length < 2)
    throw Error('Invalid charset for base conversion: '+charset)
  let base10 = 0
  for (let i=0; i<number.length; i++) {
    base10 += charset.indexOf(number[number.length-1 - i]) * Math.pow(charset.length, i)
  }
  return base10
}
function xToBase10 ( number , charset ) { if ( typeof charset != 'string' || charset . length < 2 ) throw Error ( 'Invalid charset for base conversion: ' + charset ) let base10 = 0 for ( let i = 0 ; i < number . length ; i ++ ) { base10 += charset . indexOf ( number [ number . length - 1 - i ] ) * Math . pow ( charset . length , i ) } return base10 }
Convert base X (as in any base) to base 10 (our number system).
Convert base X ( as in any base ) to base 10 ( our number system ) .