Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getShortcodeFromTag (tag) {
- let id = bigInt(tag.split('_', 1)[0]);
- const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
- let remainder;
- let shortcode = '';
- while (id.greater(0)) {
- let division = id.divmod(64);
- id = division.quotient;
- shortcode = `${alphabet.charAt(division.remainder)}${shortcode}`;
- }
- return shortcode;
- }
Add Comment
Please, Sign In to add comment