Skip to content

Instantly share code, notes, and snippets.

@lac5
Last active June 17, 2024 15:06
Show Gist options
  • Save lac5/8bdbefab609170196ccbcb4c9b4cc583 to your computer and use it in GitHub Desktop.
Save lac5/8bdbefab609170196ccbcb4c9b4cc583 to your computer and use it in GitHub Desktop.
export default function index(...n) {
const base = 26;
const base0 = base * 10;
const aCode = 'a'.charCodeAt(0);
const z = String.fromCharCode(base - 1 + aCode);
return n.map(function(n) {
let ret = String.fromCharCode(Math.floor(n / 10) % base + aCode) + String(Math.floor(n % 10));
while (n >= base0) {
ret = z + ret;
n -= base0;
}
return ret;
}).join('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment