mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
14 lines
354 B
JavaScript
14 lines
354 B
JavaScript
|
|
// NOTE: hard-to-distinguish characters have been remove like 0, o, O, etc...
|
|
const CHARS = '23456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ'.split('');
|
|
|
|
export function generateId (prefix) {
|
|
let id = `${prefix}/${Date.now()}/`;
|
|
|
|
for (let i = 0; i < 10; i++) {
|
|
id += CHARS[Math.floor(Math.random() * CHARS.length)];
|
|
}
|
|
|
|
return id;
|
|
}
|