Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 1x 1x 1x 841x 841x 457x 766x 384x 384x 841x 841x 841x 841x 841x 841x | let lastTimestamp = 0;
let sequence = 0;
export function shortId(): string {
const timestamp = Date.now();
if (timestamp === lastTimestamp) {
sequence++;
} else {
sequence = 0;
}
lastTimestamp = timestamp;
const timestampPart = timestamp.toString(36);
const sequencePart = sequence.toString(36).padStart(3, '0');
const randomPart = Math.random().toString(36).substring(2, 6);
return `${timestampPart}${sequencePart}${randomPart}`;
}
|