This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// requires ES2020 for BigInt support | |
const digits = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
function toBase62(number) { | |
if (number === 0n) { | |
return '0'; | |
} | |
let result = ''; | |
let remaining = number; |