Open EdwardZZZ opened 4 years ago
function str62ToBigInt(str) {
let strArr = String(str).split('').reverse();
return strArr.reduce((prev, curr, idx) => {
return prev + BigInt(radix) ** BigInt(idx) * BigInt(chars.indexOf(curr || 0));
}, 0n);
}
如果需要考虑长整形,请参考 https://github.com/EdwardZZZ/articles/issues/42